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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extract file information; FindStr

Status
Not open for further replies.

robz2009

Programmer
Apr 20, 2009
41
GB
I have been doing some research in regards to the FindStr command and think I can use this to get the information I am after. I have a text file which is approx 200,000 lines and I only wish to extract the lines which contain particular text (as well as the subsequent line as this contains a summary line which is required in my investigation). I ran the command

FINDSTR /n "380133" audit.txt > RESULTS.OUT

Which has given me the line number. I have now done some manual intervention so that I have the line numbers of where the text has been found and the subsequent line. Is there anyway I can use this list of line numbers with the FINDSTR command to get all the info I’m after?

Or alternatively if there is a way I can use the original FINDSTR command to output the matching string line and the subsequent line to an output file that would help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top