Advertisement
bpoole

Count occurrences of word in a file with grep

Jul 2nd, 2012
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.11 KB | None | 0 0
  1. #count number of occurrences of "needle" (\b signifies a word boundary)
  2. grep -o '\bneedle\b' filename | wc -l
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement