delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=0.6 required=5.0 tests=AWL,BAYES_20,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,T_TO_NO_BRKTS_FREEMAIL |
X-Spam-Check-By: | sourceware.org |
MIME-Version: | 1.0 |
Date: | Wed, 15 Sep 2010 18:30:11 -0400 |
Message-ID: | <AANLkTikzGH8GUZ5ZUytSJShfYE=KMyphyue83Q8XMm4-@mail.gmail.com> |
Subject: | awk gsub problem |
From: | Lee <ler762 AT gmail DOT com> |
To: | cygwin AT cygwin DOT com |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |