Last active
April 29, 2019 08:11
-
-
Save jwhb/ea7d0ed1c22d3ed8cfd7be00252e1f25 to your computer and use it in GitHub Desktop.
Search all PDF files in directory, show all matches for specified search text.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ ! "$#" -eq "2" ]; then | |
echo "Usage: $0 <path> <search_text>" | |
exit 1 | |
fi | |
find "$1" -name '*.pdf' -exec sh -c "pdftotext -q '{}' - | grep --with-filename --label='{}' --color -i '$2'" \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example