This is the mail archive of the
cygwin
mailing list for the Cygwin project.
awk gsub problem
- From: Lee <ler762 at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Wed, 15 Sep 2010 18:30:11 -0400
- Subject: awk gsub problem
I don't know if this is just a problem with the cygwin version of awk,
me misunderstanding something or what, but it looks like gsub isn't
working correctly in awk:
$ sh /tmp/test.awk
s= ::0:: should = ::S0::
$ cat /tmp/test.awk
awk '
BEGIN {
s="Serial0"
gsub("[a-z]","",s)
printf("s= ::%s:: should = ::S0::\n", s)
exit
} '
I also tried it with IGNORECASE=0 and with "awk --traditional" - same results.
$ which awk
/usr/bin/awk
$ awk --version
GNU Awk 3.1.8
Copyright (C) 1989, 1991-2010 Free Software Foundation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.
$
--- on a Linux box & it works the way I expected:
% sh /tmp/test.awk
s= ::S0:: should = ::S0::
% awk --version
GNU Awk 3.1.5
Copyright (C) 1989, 1991-2005 Free Software Foundation.
... snip ...
Regards,
Lee
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple