07-14-2005, 09:22 PM
|
#16
|
|
Moderator
Registered: Nov 2004
Location: Kennesaw, GA
Distribution: Ubuntu
Posts: 8,502
Rep: 
|
Re: Awk solution
Quote:
Originally posted by vladmihaisima
And here is an awk solution:
Code:
awk -- " /foo$/ {p=1;}; /bar$/ {e=1;}; /.*/ { if(p==1) {print \"somethingelse\nsecond row\"; b=1; p=0; }; if(b!=1) { print; }; if(e==1) { e=0; b=0; }}; "
Not as clear as sed though, but that comment about tells me maybe I don't like very much sed for a good reason. I admit that the above command is not very clear, but for someone used with flex, it's not that bad.(and it does what one might expect )
|
It gives you a headache? 
|
|
|
|