![]() |
|
|
grep unix.com with google
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Our Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
How do i search for the contents of list1 in list2?
hello all,
I have 2 files, list1 and list2. They can each have several thousand lines each. I want to check if list2 has any of the contents of list1, perhaps using a grep so that for instance if list1 contained arb1000 and list2 contained arb1000tt It would match this and pipe it out to seperate file, list3. I have tried a foreach loop but i get error message, "Too many words from ``" and having looked in the forums I am now not even sure if that was the best way of going about it. Anybody able to advise what the best way to do this sort of thing is? Many Thanks |
|
|||
|
Having read these forums I have now realised that the either of the following seem to do the job :
/usr/xpg4/bin/grep -f file1 < file2 or egrep -f file1 < file2 I will have to learn the uses of egrep and I am not sure why there seems to be two grep commands but I guess thats the problem with me being a unix newbie ![]() Thanks to all Cheers |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Search a pattern in a file with contents in a single line | sparks | Shell Programming and Scripting | 4 | 03-17-2009 02:51 AM |
| Search files with specfic extention and later search content | lovi_v | UNIX for Advanced & Expert Users | 2 | 07-14-2008 01:05 PM |
| Perl: Search for string on line then search and replace text | Crypto | Shell Programming and Scripting | 4 | 01-04-2008 10:24 AM |
| search for the contents in many file and print that file using shell script | cdfd123 | Shell Programming and Scripting | 3 | 10-07-2007 11:17 PM |
| Creating file contents using contents of another file | ReV | Shell Programming and Scripting | 21 | 02-24-2006 10:25 AM |