bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Gawk gsub puzzle


From: Aharon Robbins
Subject: Re: Gawk gsub puzzle
Date: Tue, 18 Jul 2006 22:27:38 +0300

Under windows, it's almost impossible to put an awk program into the gawk
command line.  The command interpreter is stripping the quotes from the "ZZZ"
so gawk sees a variable named ZZZ whose value is the null string.

Arnold

> Date: Fri, 07 Jul 2006 17:19:44 +0000
> From: Celsus English <address@hidden>
> Subject: Gawk gsub puzzle
> To: address@hidden
>
> I'm using GNU Awk 3.1.3.
>
> Am I missing something here in this very simple test ? .....
>
> Infile.txt contains
> AAABBB
> CCCDDD
> AAACCC
> BBBDDD
>
> TestGAWK1.bat contains
> gawk -f Changes.txt Infile.txt > Outfile.txt
>
> Changes.txt contains
> {gsub(/AAA/,"ZZZ");print}
>
> When I run TestGAWK1.bat, Outfile.txt as expected contains
> ZZZBBB
> CCCDDD
> ZZZCCC
> BBBDDD
>
>
> Now, the plot deepens ...
>
> TestGAWK2.bat contains
> gawk {gsub(/AAA/,"ZZZ");print} Infile.txt > Outfile.txt
>
> When I run TestGAWK2.bat, Outfile.txt contains
> BBB
> CCCDDD
> CCC
> BBBDDD
>
> The substitution didn't work ! Any help appreciated.
>
> Regards,
> Celsus English
>
> _________________________________________________________________
> Discover the magic of RSS feeds at MSN Ireland! http://ie.msn.com/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]