That worked perfectly but it was so simple I thought it should be a one-liner. BTW, I really enjoyed Peteris Krumins' Sed, Awk and Perl one-liner books. I bought them all in PDF and then bought the pretty No Starch Press version of Perl One-Liners (makes a great coffee table book - I just pick it up and open it to any page and I'm intrigued - Fun!) So, I took a stab at it. It worked perfectly the first time but it was really just my same program in one-liner format. So here it is. If you have a more elegant solution let me know.
perl -pe 'if (m/SUCCESS/) {print "\n$_"} else {print $_} ' JavaReport.txt
P.S. The I tried Awk:
awk '/SUCCESS/ { print "\n" } {print}' JavaReport.txt
(although this isn't quite right)
This comment has been removed by the author.
ReplyDeletehello,
ReplyDeleteperl -i -pe '$_="$_\n" if /SUCCESS/ ' JavaReport.txt
should probably do the job
Yes! That's what I was looking for! That short hand references. Pretty cool stuff! Thanks!
Delete