[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gsub w/ field-separator
From: |
Duran, Richard |
Subject: |
gsub w/ field-separator |
Date: |
Thu, 14 Aug 2003 13:08:55 -0500 |
I've noticed what I believe to be a bug:
echo "a b:cde:f g" | awk -F : '{gsub(/ /,"",$1);print}' -
produces "ab cde f g" instead of the expected "ab:cde:f g". It seems to be
replacing the value of the field separator w/ a space (which I've just now
noticed to be the default value of OFS).
The following works just fine:
echo "a b:cde:f g" | awk -F : '{OFS=":";gsub(/ /,"",$1);print}' -
But why doesn't
echo "a b:cde:f g" | awk -F : '{print}' -
require that OFS to be assigned a value of ":"?
(Red Hat 9 RPM: gawk-3.1.1-9)
Regards,
-richard duran
- gsub w/ field-separator,
Duran, Richard <=