Skip to content

Instantly share code, notes, and snippets.

@jcuenod
Created May 20, 2022 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcuenod/7a1e8546dfdfb9cec47b8b3044ef1709 to your computer and use it in GitHub Desktop.
Save jcuenod/7a1e8546dfdfb9cec47b8b3044ef1709 to your computer and use it in GitHub Desktop.
#!/bin/bash
# usage: ./search_libreoffice_documents.sh search_term
# If you want to search types other than `.odt`, edit this line
find . -type f -name "*.odt" | while read i ; do
[ "$1" ] || { echo "You forgot search string!" ; exit 1 ; }
unzip -ca "$i" 2>/dev/null | grep -aoi -E ".{0,10}$*.{0,10}"
if [ $? -eq 0 ] ; then
echo "$i: $?" | nl
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment