×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

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

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

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

(OP)
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.

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

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
http://www.greggriffiths.org/livelink/

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

(OP)
thank you for the reply!
I'm OK now. I just reloaded the file after I found the first match.
Thank you.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close