bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] Strange behavior in gawk


From: Derrik Walker v2.0
Subject: Re: [bug-gawk] Strange behavior in gawk
Date: Sat, 06 Dec 2014 23:22:23 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1

On 12/06/2014 10:29 PM, Andrew J. Schorr wrote:

Another solution is to reassign $0.  If you change your script to say:

/:/ {
     FS=":"
     $0 = $0
     print "NF = " NF " - " $0
}

/\./ {
     FS="."
     $0 = $0
     print "NF = " NF " - " $0
}

Then you will get the desired results:

NF = 3 - 1:2:3
NF = 3 - 4:5:6
NF = 4 - .a.b.c
NF = 4 - .e.f.g

Regards,
Andy

This looks promising and works great in my test script. When I'm at work, I'll try it on the actual script I was working on.

Thanks!

--
-- Derrik

Derrik Walker v2.0, RHCE
address@hidden

"Those UNIX guys, they think weird!" -- John C. Dvorak




reply via email to

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