Afficher un message
Vieux 21/08/2006, 13h13   #5
Ed Morton
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: awk script to insert blank line between matching patterns

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/&&/
'

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

Regards,

Ed.
  Réponse avec citation
 
Page generated in 0,04407 seconds with 9 queries