From: mark@ispc001.demon.co.uk (Mark Katz)
Subject: Re: AWK on digital UNIX.
Date: 1997/03/06 [thread overview]
Message-ID: <857638970snz@ispc001.demon.co.uk> (raw)
In-Reply-To: 331DC423.38DB@rpspo2.atlantaga.ncr.com
In article <331DC423.38DB@rpspo2.atlantaga.ncr.com>
rchannav@rpspo2.atlantaga.ncr.com writes:
>Recently I had to write a script in awk on DIGITAL - UNIX 4.0.
>I was surprised by this ambiguous output and see if it is the
>way in DIGITAL UNIX. The code segment is as follows
>
>awk -F\, '{
> gsub(/ /,//,$2)
> print $0
> }' < /tmp/tmp.txt
>
>the tmp.txt is like this
>
>hello,fo o,123
>foo,bar,123
>bar,ba r,123 etc.,
>
>Basically I am stripping the blanks from second field. The output it
>produces is in the following format
>
>hello,fo10,123 ****<- do you mean hello,fo1o,123
>foo,bar,123
>bar,ba1r,123
>
>I know that gsub returns the no.of occurences, but why in $2??
I find this very hard to believe!
What else do you do in the program. gsub does **not** return the number
of substitutions it does.
If no-one else suggest what is happening, send me the entire program
with some real data and we'll check it out on *real* awk compiler/interpreters!
Mark
--
Mark Katz
ISPC, London - Innovation in data-delivery tools
Tel: (44) 181-455 4665, Fax (44) 181-458 9554
** Visit our website on http://www.efiche.com/efiche **
next prev parent reply other threads:[~1997-03-06 5:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-03-05 5:00 AWK on digital UNIX rchannav
1997-03-06 5:00 ` Mark Katz [this message]
1997-03-06 5:00 ` Mark Katz
1997-03-07 5:00 ` Pete Ford
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox