Watnog
asked on
Unix scripting: need last (or second last) line before each blank line
Hello again (where would I be without you).
In a file I need last line before each blank, unless last line has regex HOLD in it, then I would need the second last line. See attached screenshot.
Bottomline, I need lines with last runtime of each job.
Thanks for your help.
conman.jpg
In a file I need last line before each blank, unless last line has regex HOLD in it, then I would need the second last line. See attached screenshot.
Bottomline, I need lines with last runtime of each job.
Thanks for your help.
conman.jpg
perl -ne '/\w/||print $l;/HOLD/||($l=$_)' file
ASKER
Thanks, that's great.
I discover that what I thought to be blank lines fact aren't, :-~
They would become if I can get rid of the last 2 columns, see attached.
That would make your oneliner work as intended.
Cheers.
conman1.jpg
I discover that what I thought to be blank lines fact aren't, :-~
They would become if I can get rid of the last 2 columns, see attached.
That would make your oneliner work as intended.
Cheers.
conman1.jpg
ASKER
Last 2 columns that is 'Returncode' and 'Dependencies'.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Wonderful.
Thx.
Thx.