Tuesday, November 20, 2012

Words matching in two FILES

Suppose you have to check two files with having same words in both files, you can use the following command in Linux.

fgrep -wf file1 file2 | wc -l

This will return word count in both file1 & file2.

For more details, man fgrep in Linux.