Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #This will search all pdf files for all 9 digit numerical matches
- #this includes 9 digits together or with dashes or comas (etc).
- output="ssn"
- find -iname "*.pdf"| while read pdf
- do
- match="$(pdftotext -layout "$pdf" - 2>/dev/null |grep '[0-9]\{3\}-\{0,1\}[0-9]\{2\}-\{0,1\}[0-9]\{4\}')"
- [[ "$match" ]] && echo "$pdf - $match"|tr -s " "
- done|tee "$output"|grep '[0-9]\{3\}-\{0,1\}[0-9]\{2\}-\{0,1\}[0-9]\{4\}'
- #final grep above it just for highlighting the matches
- #to narrow the search to SSN formatted with dashes use this.
- grep "[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]" "$output"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement