[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNU Awk 3.1.5 proglems with OFS
From: |
Aharon Robbins |
Subject: |
Re: GNU Awk 3.1.5 proglems with OFS |
Date: |
Sat, 08 Sep 2007 23:14:35 +0300 |
Greetings.
Gawk is behaving just fine. OFS only comes into play when using the
print command with commas to separate values, or if you rebuild the
record. However, $0 is the entire _original_ input record, including
the whitespace.
$ gawk 'BEGIN { OFS = "|" ; print 1, 2, 3 }'
1|2|3
$ echo a b c | gawk 'BEGIN { OFS = "|" } ; { print $1, $2 ; print $0 }'
a|b
a b c
$ echo a b c | gawk 'BEGIN { OFS = "|" } ; { $1 = $1 ; print $0 }'
a|b|c
Hope this helps,
Arnold
> Date: Fri, 07 Sep 2007 10:35:09 +0200
> From: =?UTF-8?Q?ywd?= <address@hidden>
> Subject: =?UTF-8?Q?GNU_Awk_3.1.5_proglems_with_OFS?=
> To: address@hidden
>
> It's seems to ignore value of OFS variable:
> address@hidden Belsk]$ cat >>plik1
> ss
> aa
> ffggga ewr fawe
> address@hidden Belsk]$ awk 'BEGIN{OFS="|"};{print $0}' plik1
> ss
> aa
> ffggga ewr fawe
>
> System:
> GNU/Linux 2.6.18-8.1.8.e15.centos.plus x86_64
> GNU Awk 3.1.5
> But this problem repeats on other systems/machines.
>
> Best Regards,
> Szymon.