Thursday, December 24, 2009

More grep...

  • Sorting - "cat myfile | grep searchPhrase | sort"
  • Distinct behaviour - "cat myfile | grep searchPhrase | sort | uniq"

Wednesday, December 9, 2009

Count occurrence of words in a file

  • grep -c "myword" < file  
  • cat file | grep -c "myword"