For Programmers: Free Programming Magazines  


Home > Archive > AWK > December 2004 > Re: Removing text between braces









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Removing text between braces
Frank

2004-12-29, 8:55 pm

"Janis Papanagnou" <Janis_Papanagnou@hotmail.com> wrote in message
news:cqv8sp$e0p$2@online.de...
> awk '/{/,/}/ { next } 1'


Thanks! That worked like a charm & much easier than my solution :)

One final question: is there an option in gawk that allows you to modify a
file in-place (like SED's -i option)? In my original script I was closing
the original file and then writing over it (since I had already read
everything into an array). I'm using GNU Awk 3.1.0 and I don't see any such
option.


Janis Papanagnou

2004-12-29, 8:55 pm

Frank wrote:
> "Janis Papanagnou" <Janis_Papanagnou@hotmail.com> wrote in message
> news:cqv8sp$e0p$2@online.de...
>
>
> Thanks! That worked like a charm & much easier than my solution :)
>
> One final question: is there an option in gawk that allows you to modify a
> file in-place (like SED's -i option)? In my original script I was closing
> the original file and then writing over it (since I had already read
> everything into an array). I'm using GNU Awk 3.1.0 and I don't see any such
> option.


I either don't know of any awk option; you'll have to do a file move, e.g.

awk '...' <orig >new ; mv new orig

If you insist to do it inplace you may want to use perl instead of awk.
Your choice.

Janis
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com