bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] gsub inbuilt function


From: Manuel Collado
Subject: Re: [bug-gawk] gsub inbuilt function
Date: Sun, 23 Feb 2014 22:48:43 +0100
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.1.1

El 23/02/2014 20:11, Aharon Robbins escribió:
On Sun, Feb 23, 2014 at 10:26:19PM +0530, Ujjwal Kumar wrote:
Have a small query :
    Why must the gsub function reduce number of white space between
fields to one ??

This is sometimes undesirable and so I feel ideally it should leave
the rest of the string untouched.

From: "Andrew J. Schorr" <address@hidden>
Can you please provide an example of awk code and data that
cause the problem to which you are referring?

Along with an indication of which version of gawk you are using (from
gawk --version), and on what system.

Perhaps the OP is using a code like this (-> is keyboard input):

$ gawk '{gsub("a", "b", $1); print}'
-> a b c d
b b c d
-> a   b   c   d
b b c d

Of course, this is expected behavior. Modifying $1 gets $0 rebuilt using OFS as field delimiter.

--
Manuel Collado - http://lml.ls.fi.upm.es/~mcollado




reply via email to

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