Intersection of Two Files
February 4, 2009 – 12:10 amTo find the lines which occur in each of two files, ie if you have the following two files:
File1:
line1
line2
line3
line4
line5
File2:
line4
line5
line6
line7
and want a command which will return:
line4
line5
Use:
grep -f File1 File2
Blogged with the Flock Browser


2 Responses to “Intersection of Two Files”
Hi,
This is a (probable) correction in the “Bash Shortcuts Quick Reference” page. Since I couldn’t find any place other than this to communicate to you, I’m posting this here.
The page lists Alt-] x as moving to next occurrence of x, while Ctrl-] seems to be the correct one.
Thanks for the very useful quick reference.
Regards,
Sundar.
By Sundar on Aug 25, 2009
Thank you, well spotted. I’ve corrected that now.
By mike on Sep 21, 2009