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
William James

2004-12-29, 8:55 pm


Frank wrote:
> 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.


If you store the lines in an array, you can simply write them
in the END section:

END {
for (i=1; i in Whole_File; i++ )
print Whole_File[ i ] >FILENAME }
The language Ruby has the in-place (-i) option.

Sponsored Links







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

Copyright 2008 codecomments.com