need help ...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting need help ...
# 1  
Old 11-25-2008
Hammer & Screwdriver need help ...

Hi,

I have two files file1, file2. Now I want to display records of file1 those are in file2
-------i/p-------
file1
08821 09440
08813 09848
08812 09940
040 09940
0411 09940

file2
08812
040

----out put----
08812 09940
040 09940

SureshSmilie
# 2  
Old 11-25-2008
Depending on if your file2 has other stuff in it besides the values you're trying to compare, you could just do something like this:

Code:
grep -f file2 file1

that will use file2 as a file of patterns to search for in file1
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question