Find Common lines between files


Handy commands for finding either the commonality or difference between the files.

Find Common lines within a file

perl -ne 'print if ($seen{lc $_} .= @ARGV) =~ /10$/' file2.txt file2.txt | less

To find the difference between two files

sdiff file1.txt file2.txt | less
Advertisements

One thought on “Find Common lines between files

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s