![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Search, replace string in file1 with string from (lookup table) file2? | gstuart | Shell Programming and Scripting | 9 | 06-08-2009 07:11 AM |
| grep -f file1 file2 | vijay_0209 | Shell Programming and Scripting | 7 | 03-05-2009 05:48 AM |
| Search values between ranges in File1 within File2 | cgkmal | Shell Programming and Scripting | 4 | 01-31-2009 06:37 PM |
| awk/sed search lines in file1 matching columns in file2 | floripoint | Shell Programming and Scripting | 1 | 12-17-2008 11:36 PM |
| Awk Compare File1 File2 on f2 | RacerX | Shell Programming and Scripting | 4 | 10-27-2008 09:50 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
file1: has all words to be searched.
100007 200999 299997 File2: has all file names to be searched. C:\search1.txt C:\search2.txt C:\search3.txt C:\search4.txt Outfile: should have all found lines. Logic: Read each word in file1 and search each file in the list of File2; if the word found; print the entire line in outfile. Pls help, thanks in advance. |
|
||||
|
Quote:
do while read filename do if [[ `grep -c "$string" $filename` > 0 ]] then grep "$string" $filename fi done < file2 done < file1 cheers, Devaraj Takhellambam |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|