mercredi 2 avril 2014

Parsing A File

"I have a problem and I want to solve it using regular expressions".

"Well, now you have two problems".






Right! So, here's my 2 problems.



I want to capture information from a file and pull out only jobs that run on a particular server.



What I need is something that will do the following:



1. Find the line that contains this string: /*------DIAGNOSTIC: US6DCMD01

2. Capture everything from this line until the next occurance of /*------------ that occurs in column 1. (more dashes than on the diagnostic line)

3. Possible snag: There can be a duplicate DIAGNOSTIC line directly under the first one.





Is this do-able in perl or sed/awk?, or am I doomed to cut & paste land?



*not asking anyone to do it for me, just if it can be done and the best tool to use to do it, then I'll go try to figure it out.



thanks!





via JREF Forum http://ift.tt/1pRhCID

Aucun commentaire:

Enregistrer un commentaire