1*e6d6c189SCody Peter Mello# From bug-gawk-bounces+arnold=skeeve.com@gnu.org Tue Jul 12 08:18:24 2011 2*e6d6c189SCody Peter Mello# Return-Path: <bug-gawk-bounces+arnold=skeeve.com@gnu.org> 3*e6d6c189SCody Peter Mello# Received: from localhost (localhost [127.0.0.1]) 4*e6d6c189SCody Peter Mello# by skeeve.com (8.14.3/8.14.3) with ESMTP id p6C5HArm002260 5*e6d6c189SCody Peter Mello# for <arnold@localhost>; Tue, 12 Jul 2011 08:18:23 +0300 6*e6d6c189SCody Peter Mello# X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on sls-af11p1 7*e6d6c189SCody Peter Mello# X-Spam-Level: 8*e6d6c189SCody Peter Mello# X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DNS_FROM_OPENWHOIS, 9*e6d6c189SCody Peter Mello# RCVD_IN_DNSWL_MED autolearn=ham version=3.2.5 10*e6d6c189SCody Peter Mello# X-Envelope-From: bug-gawk-bounces+arnold=skeeve.com@gnu.org 11*e6d6c189SCody Peter Mello# Received: from server1.f7.net [66.148.120.132] 12*e6d6c189SCody Peter Mello# by localhost with IMAP (fetchmail-6.3.11) 13*e6d6c189SCody Peter Mello# for <arnold@localhost> (single-drop); Tue, 12 Jul 2011 08:18:23 +0300 (IDT) 14*e6d6c189SCody Peter Mello# Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) 15*e6d6c189SCody Peter Mello# by freefriends.org (8.14.4/8.14.4) with ESMTP id p6BIYi4t032040; 16*e6d6c189SCody Peter Mello# Mon, 11 Jul 2011 14:34:48 -0400 17*e6d6c189SCody Peter Mello# Received: from localhost ([::1]:38787 helo=lists.gnu.org) 18*e6d6c189SCody Peter Mello# by lists.gnu.org with esmtp (Exim 4.71) 19*e6d6c189SCody Peter Mello# (envelope-from <bug-gawk-bounces+arnold=skeeve.com@gnu.org>) 20*e6d6c189SCody Peter Mello# id 1QgLJb-0004tM-Eg 21*e6d6c189SCody Peter Mello# for arnold@skeeve.com; Mon, 11 Jul 2011 14:34:43 -0400 22*e6d6c189SCody Peter Mello# Received: from eggs.gnu.org ([140.186.70.92]:54022) 23*e6d6c189SCody Peter Mello# by lists.gnu.org with esmtp (Exim 4.71) 24*e6d6c189SCody Peter Mello# (envelope-from <kornet@camk.edu.pl>) id 1QgD0R-0004Vi-HZ 25*e6d6c189SCody Peter Mello# for bug-gawk@gnu.org; Mon, 11 Jul 2011 05:42:24 -0400 26*e6d6c189SCody Peter Mello# Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) 27*e6d6c189SCody Peter Mello# (envelope-from <kornet@camk.edu.pl>) id 1QgD0Q-0000SE-8u 28*e6d6c189SCody Peter Mello# for bug-gawk@gnu.org; Mon, 11 Jul 2011 05:42:23 -0400 29*e6d6c189SCody Peter Mello# Received: from moat.camk.edu.pl ([148.81.175.50]:34696) 30*e6d6c189SCody Peter Mello# by eggs.gnu.org with esmtp (Exim 4.71) 31*e6d6c189SCody Peter Mello# (envelope-from <kornet@camk.edu.pl>) id 1QgD0P-0000Px-V3 32*e6d6c189SCody Peter Mello# for bug-gawk@gnu.org; Mon, 11 Jul 2011 05:42:22 -0400 33*e6d6c189SCody Peter Mello# Received: from localhost (localhost.localdomain [127.0.0.1]) 34*e6d6c189SCody Peter Mello# by moat.camk.edu.pl (Postfix) with ESMTP id 72C1D5F004C 35*e6d6c189SCody Peter Mello# for <bug-gawk@gnu.org>; Mon, 11 Jul 2011 11:42:13 +0200 (CEST) 36*e6d6c189SCody Peter Mello# X-Virus-Scanned: amavisd-new at camk.edu.pl 37*e6d6c189SCody Peter Mello# Received: from moat.camk.edu.pl ([127.0.0.1]) 38*e6d6c189SCody Peter Mello# by localhost (liam.camk.edu.pl [127.0.0.1]) (amavisd-new, port 10024) 39*e6d6c189SCody Peter Mello# with LMTP id oh+-Yw+zHhK6 for <bug-gawk@gnu.org>; 40*e6d6c189SCody Peter Mello# Mon, 11 Jul 2011 11:42:07 +0200 (CEST) 41*e6d6c189SCody Peter Mello# Received: from gatekeeper.camk.edu.pl (gatekeeper.camk.edu.pl [192.168.1.23]) 42*e6d6c189SCody Peter Mello# by moat.camk.edu.pl (Postfix) with ESMTP id 89AA55F0046 43*e6d6c189SCody Peter Mello# for <bug-gawk@gnu.org>; Mon, 11 Jul 2011 11:42:07 +0200 (CEST) 44*e6d6c189SCody Peter Mello# Received: by gatekeeper.camk.edu.pl (Postfix, from userid 1293) 45*e6d6c189SCody Peter Mello# id 796C8809FB; Mon, 11 Jul 2011 11:42:07 +0200 (CEST) 46*e6d6c189SCody Peter Mello# Date: Mon, 11 Jul 2011 11:42:07 +0200 47*e6d6c189SCody Peter Mello# From: Kacper Kornet <draenog@pld-linux.org> 48*e6d6c189SCody Peter Mello# To: bug-gawk@gnu.org 49*e6d6c189SCody Peter Mello# Message-ID: <20110711094207.GA2616@camk.edu.pl> 50*e6d6c189SCody Peter Mello# MIME-Version: 1.0 51*e6d6c189SCody Peter Mello# Content-Type: text/plain; charset=iso-8859-2 52*e6d6c189SCody Peter Mello# Content-Disposition: inline 53*e6d6c189SCody Peter Mello# User-Agent: Mutt/1.5.20 (2009-06-14) 54*e6d6c189SCody Peter Mello# X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 55*e6d6c189SCody Peter Mello# X-Received-From: 148.81.175.50 56*e6d6c189SCody Peter Mello# X-Mailman-Approved-At: Mon, 11 Jul 2011 14:34:26 -0400 57*e6d6c189SCody Peter Mello# Subject: [bug-gawk] Change in behavior of gsub inside loop 58*e6d6c189SCody Peter Mello# X-BeenThere: bug-gawk@gnu.org 59*e6d6c189SCody Peter Mello# X-Mailman-Version: 2.1.14 60*e6d6c189SCody Peter Mello# Precedence: list 61*e6d6c189SCody Peter Mello# List-Id: "Bug reports and all discussion about gawk." <bug-gawk.gnu.org> 62*e6d6c189SCody Peter Mello# List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gawk>, 63*e6d6c189SCody Peter Mello# <mailto:bug-gawk-request@gnu.org?subject=unsubscribe> 64*e6d6c189SCody Peter Mello# List-Archive: </archive/html/bug-gawk> 65*e6d6c189SCody Peter Mello# List-Post: <mailto:bug-gawk@gnu.org> 66*e6d6c189SCody Peter Mello# List-Help: <mailto:bug-gawk-request@gnu.org?subject=help> 67*e6d6c189SCody Peter Mello# List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gawk>, 68*e6d6c189SCody Peter Mello# <mailto:bug-gawk-request@gnu.org?subject=subscribe> 69*e6d6c189SCody Peter Mello# Errors-To: bug-gawk-bounces+arnold=skeeve.com@gnu.org 70*e6d6c189SCody Peter Mello# Sender: bug-gawk-bounces+arnold=skeeve.com@gnu.org 71*e6d6c189SCody Peter Mello# Status: R 72*e6d6c189SCody Peter Mello# 73*e6d6c189SCody Peter Mello# Hi, 74*e6d6c189SCody Peter Mello# 75*e6d6c189SCody Peter Mello# I have observed the following changed behavior between gawk-3.8.1 and 76*e6d6c189SCody Peter Mello# gakw-4.0.0. While in the former 77*e6d6c189SCody Peter Mello# 78*e6d6c189SCody Peter Mello# echo -ne ' aaa' | gawk '{for (c = 1; c <= NF; c++) {gsub("foo", "bar", $c); print}}' 79*e6d6c189SCody Peter Mello# 80*e6d6c189SCody Peter Mello# prints: 81*e6d6c189SCody Peter Mello# 82*e6d6c189SCody Peter Mello# aaa 83*e6d6c189SCody Peter Mello# 84*e6d6c189SCody Peter Mello# the gawk-4.0.0 does not preserve the leading spaces and prints: 85*e6d6c189SCody Peter Mello# 86*e6d6c189SCody Peter Mello# aaa 87*e6d6c189SCody Peter Mello# 88*e6d6c189SCody Peter Mello# Best regards, 89*e6d6c189SCody Peter Mello# -- 90*e6d6c189SCody Peter Mello# Kacper 91*e6d6c189SCody Peter Mello# 92*e6d6c189SCody Peter Mello{for (c = 1; c <= NF; c++) {gsub("foo", "bar", $c); print}} 93