Is there a way to count the occurrence of a certain word in document and PDF files? A solution which works on Windows will be most helpful.
I need to use it with various languages.
PDF:
In the terminal:
pdftotext YOUR_PDF.pdf YOUR_PDF.txt
grep -ci 'word' YOUR_PDF.txt
Edit:
One-liner : pdftotext YOUR_PDF.pdf - | grep -ci 'word'
grep -c
option only counts lines, not words. (For example, try echo hi hi | grep -c hi
; it only says "1".) As a work-around, split up the words on spaces: echo hi hi | sed -e 's/ /\n/g' | grep -c hi
Mar 17, 2011 at 7:07