Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read each word from File1 and search each file in file2

Status
Not open for further replies.

clem2610

Programmer
Apr 21, 2009
2
US
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.
 
What have you tried so far and where in your code are you stuck ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I do not have any AWK code; I have c# code; It takes a long time to process it in c#; and so I want to do it AWK. 10 yrs back I did some work in AWK;
 

The file names seem to be WinDoze files.
Try using the WinDoze Explorer "Search" functionality.

[nosmiley]



----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 

Or if your OS is Unix, maybe you can just use grep
Code:
cat file2| xargs grep -f file1 >outfile
[noevil]


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top