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

Need to print only the first line that has a match ...

Status
Not open for further replies.

Tester_V

Technical User
Nov 22, 2019
54
0
0
US
Hi,
Need to print only the first line that has a match ...
I have a line in a file :
“ 2019-02-02 17:12:02.860,10552 ,Information," Test Program Name: Something else“
And the part of the line I need is - “Test Program Name: Something else”
I’d like to print only first line that matched the strings that have the same “ Test Program Name: “

And the same for this line:
“2019-02-02 17:12:02.865,10552 ,Information,"[LOT] Product: Something else"
I need only this part of the line - “Product: Something else”
I’d like to print only the first line that matches and ignore the rest of the lines that matched.
Thank you.
 
how are you processing the file ? are you using a loop to step through each line ?

For the checks you could either use a SPLIT type thing on the comma and then check the value returned in an array or perhaps use a RegEx.

Greg Griffiths
Livelink Certified Developer & ECM Global Star Champion 2005 & 2006
 
thank you for the reply!
I'm OK now. I just reloaded the file after I found the first match.
Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top