Afficher un message
Vieux 21/08/2006, 14h10   #7
Troy Piggins
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: awk script to insert blank line between matching patterns

* Ed Morton <morton@lsupcaemnt.com> :
> Troy Piggins wrote:
> >* Rakesh Sharma <sharma__r@hotmail.com> :
> >>Troy Piggins wrote:
> >>
> >>>I'm not too good with awk, but I don't think this can be done
> >>>with sed.

> >Apparently not too good with sed either ;-\
> >>sed -e '

> >If this can be done with sed then great,

>
> Not really. Isn't this:
>
> awk '
> /^--$/ && !prev { print "" }
> { print; prev = $0 }
> '
>
> a little more easily understandable than the posted sed
> solution:
>
> sed -e '
> $!N
> /^\n/{P;D;}
> /\n.*signature/!{P;D;}
> s/\n/&&/
> '


Agreed.

> sed is a fine tool for simple operations, but there's just no
> point attempting anything more with it.


That's what I thought, and that's why my OP assumed awk would be
the tool. Thankyou for your solution. I'll do some reading
tomorrow when I get a chance to disect it. It certainly reads
easy.

Cheers

--
Troy Piggins
,-o
o ) Ubuntu linux 6.06 http://ubuntu.com RLU#415538 http://counter.li.org
`-o uptime: 23:07:48 up 12 days,16:04,2 users,load average:0.00,0.05,0.03
  Réponse avec citation
 
Page generated in 0,05244 seconds with 9 queries