The UNIX and Linux Forums
Forum Home
Linux and Unix Man Pages
Search Forums
Search Community Posts
Today's Posts
Quick Links
Man Pages
RedHat Commands
OpenSolaris Commands
Linux Commands
SunOS Commands
FreeBSD Commands
All UNIX Man Pages
All Linux Man Pages
Full Man Repository
Login or Register to Ask a Question and Join Our Community
Search Forums
Show Threads .
Show Posts
Tag Search
Advanced Search
Quick Links
Contact Us
Forum Rules
Today's Posts
FAQ
Pictures & Albums
All Albums
Miscellaneous
What is My IP
Whois
Mark Forums Read
Shell Programming and Scripting
need help ...
Tags
need help
,
shell scripts
Login to Discuss or Reply to this Discussion in Our Community
Thread Tools
Search this Thread
Top Forums
Shell Programming and Scripting
need help ...
#
1
11-25-2008
suresh3566
Registered User
80,
0
Join Date: May 2008
Last Activity: 2 October 2016, 8:18 PM EDT
Posts: 80
Thanks Given: 2
Thanked 0 Times in 0 Posts
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
Suresh
suresh3566
View Public Profile for suresh3566
Find all posts by suresh3566
#
2
11-25-2008
Gee-Money
Registered User
48,
0
Join Date: Sep 2008
Last Activity: 10 August 2009, 7:08 AM EDT
Posts: 48
Thanks Given: 0
Thanked 0 Times in 0 Posts
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
Gee-Money
View Public Profile for Gee-Money
Find all posts by Gee-Money
Login or Register to Ask a Question
Previous Thread
|
Next Thread
Login or Register to Ask a Question
Member Badges and Information Modal
×