Skip to content

Instantly share code, notes, and snippets.

@k-stailey
Created September 24, 2014 14:25
Show Gist options
  • Save k-stailey/b9294351be436958cfa4 to your computer and use it in GitHub Desktop.
Save k-stailey/b9294351be436958cfa4 to your computer and use it in GitHub Desktop.
Lost some stupid info because it's in a LibreOffice file? Line up the suspects fast.
#! /bin/bash
if [ $# -ne 1 ]; then
echo "Usage: `basename $0` searchterm (regex)"
exit 1
fi
(locate .odt | grep odt$ ; locate .ods | grep ods$) |
while read file
do
unzip -ca "$file" content.xml | grep -il "$1" > /dev/null
if [ $? -eq 0 ]; then
echo "$file"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment