From unknown Sun Aug 17 01:23:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24025: Resent-From: Leroy Harrill Original-Sender: "Debbugs-submit" Resent-CC: bug-grep@gnu.org Resent-Date: Tue, 19 Jul 2016 15:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 24025 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: 24025@debbugs.gnu.org X-Debbugs-Original-To: bug-grep@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.14689426397702 (code B ref -1); Tue, 19 Jul 2016 15:38:01 +0000 Received: (at submit) by debbugs.gnu.org; 19 Jul 2016 15:37:19 +0000 Received: from localhost ([127.0.0.1]:57456 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPX5C-000209-RK for submit@debbugs.gnu.org; Tue, 19 Jul 2016 11:37:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40178) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPTrz-0003o6-9V for submit@debbugs.gnu.org; Tue, 19 Jul 2016 08:11:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPTrq-0001On-Cm for submit@debbugs.gnu.org; Tue, 19 Jul 2016 08:11:22 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:52877) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPTrq-0001Oe-9B for submit@debbugs.gnu.org; Tue, 19 Jul 2016 08:11:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPTro-0001SY-4a for bug-grep@gnu.org; Tue, 19 Jul 2016 08:11:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPTri-0001Ng-Tq for bug-grep@gnu.org; Tue, 19 Jul 2016 08:11:15 -0400 Received: from mail-it0-x229.google.com ([2607:f8b0:4001:c0b::229]:36881) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPTri-0001Na-PD for bug-grep@gnu.org; Tue, 19 Jul 2016 08:11:10 -0400 Received: by mail-it0-x229.google.com with SMTP id f6so17584631ith.0 for ; Tue, 19 Jul 2016 05:11:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=GviIrfxIA2UvykgmjRUN+CYU4b4Z5q+aL+1WiuspdX0=; b=KxgYTpIXtlRfWlzWahCQcWnzygrTj1dGnm0gWkcxSJQJGyaOGy/z0z20BuD+SxWExE bOIr94hvXvPXYug9n8uhVoG/veYtmX+6wRgwDjTOrl50F7uBBUKE080FPvaexoYvsCIh Mx7iCjHHggz6BwU34iqQ4LjpUIJIW21UDYz7CTZ6J7TcigYWJ0yC20TegiZIF5kfP1SZ T+3Jn/iU6P6jA/+MLYoUU+BcgNgsRUbqnuB+B9Kik+vNUtfFhRXK7xVnKqMXkUmS3O2u +m09M4XfBNHDG81SEFnPO3+oPLuPphQg+qSQNKK9jlaXe7HyX6XufOeHI5FoIemGC89y 1WnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=GviIrfxIA2UvykgmjRUN+CYU4b4Z5q+aL+1WiuspdX0=; b=iqDM2ukKO0f6MjjC3HWWIF6uhSJLRrviXamaY9TJZYLd5DAkFbd57MW5TjbxffH6oX nLsGw8GgTkmo77x1gag2LWhgl938fQ8Ta5H7sqKwqA+IziFSD7ydDp4Y+ZEW0z/kcINd bEZRr4IEH3LvJTA9rnlabo3uE5eDpxPovHUdmUrpWAXM6EsVbuBZqpAkexnZBqR7suQN ddUykXcWvFENuX7lM42Sud99UGiuaEdiVItMK3xzMiWi3t7i3aNtabmszxqn/zM9I5+W ezr73uL5nzw71VQnjJi8ilBieYVRsQN5X9Yn7kAJGsu0RRKJZJ6MvjbiejBHyQCCC30/ N2PQ== X-Gm-Message-State: ALyK8tJQDHQ4MB9OuvAnJ5P1WA8JfHHTidOu8PZyUCbSl40eQjctp5J4JG7VmR21GaN6XT5j7VF4c6h44IkVdQ== X-Received: by 10.36.64.5 with SMTP id n5mr1450231ita.78.1468930269853; Tue, 19 Jul 2016 05:11:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.28.71 with HTTP; Tue, 19 Jul 2016 05:11:09 -0700 (PDT) From: Leroy Harrill Date: Tue, 19 Jul 2016 08:11:09 -0400 Message-ID: Content-Type: multipart/alternative; boundary=001a1143da8cef3c970537fbfab1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -1.8 (-) X-Mailman-Approved-At: Tue, 19 Jul 2016 11:37:18 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.8 (-) --001a1143da8cef3c970537fbfab1 Content-Type: text/plain; charset=UTF-8 I am not sure if this is a bug or not. Her is an example of my script that I am running. #!/bin/bash rm -f x.txt rm -f new_file i=1 wc -l file1 | sed 's/file1//g' >> x.txt x=$(> new_file grep $A some_file.txt ((i++)) done grep does not appear to be grepping inside of the while loop. When I initialize a variable directly from the command line and write the same script it works no problem, any help on this matter would be greatly appreciated. --001a1143da8cef3c970537fbfab1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I am not sure if this is a bug or not. Her is an exam= ple of my script that I am running.

#!/bin/bash

rm -f x.txtrm -f new_file

i=3D1
wc -l file1 | sed 's/file1//g' >= ;> x.txt

x=3D$(<x.txt)

while [ $i -le $x ]
do
=C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 #echo "$i"<= br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0A=3D$( awk -v var=3D"$i= " 'NR=3D=3Dvar {print}' file1)
=C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 #ack -k file1 file2 --match $A >> new_file
=C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0 grep $A some_file.txt
=C2=A0=C2=A0=C2=A0 ((i++= ))

done

grep does not appear to be grepping inside of t= he while loop. When I initialize a variable directly from the command line = and write the same script it works no problem, any help on this matter woul= d be greatly appreciated.
--001a1143da8cef3c970537fbfab1-- From unknown Sun Aug 17 01:23:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24025: Resent-From: Eric Blake Original-Sender: "Debbugs-submit" Resent-CC: bug-grep@gnu.org Resent-Date: Tue, 19 Jul 2016 16:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24025 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: Leroy Harrill , 24025@debbugs.gnu.org, GNU bug control Received: via spool by 24025-submit@debbugs.gnu.org id=B24025.146894437410391 (code B ref 24025); Tue, 19 Jul 2016 16:07:01 +0000 Received: (at 24025) by debbugs.gnu.org; 19 Jul 2016 16:06:14 +0000 Received: from localhost ([127.0.0.1]:57492 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPXXC-0002hW-3s for submit@debbugs.gnu.org; Tue, 19 Jul 2016 12:06:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45842) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPXX9-0002hE-RI; Tue, 19 Jul 2016 12:06:12 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B9319796F8; Tue, 19 Jul 2016 16:06:05 +0000 (UTC) Received: from [10.3.116.181] (ovpn-116-181.phx2.redhat.com [10.3.116.181]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6JG65gM000706; Tue, 19 Jul 2016 12:06:05 -0400 References: From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Organization: Red Hat, Inc. Message-ID: <578E4FEC.6040401@redhat.com> Date: Tue, 19 Jul 2016 10:06:04 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="WX77AjoaIEA2gPRMtqEcPTLnUkE0lB4DF" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 19 Jul 2016 16:06:05 +0000 (UTC) X-Spam-Score: -6.3 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.3 (------) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --WX77AjoaIEA2gPRMtqEcPTLnUkE0lB4DF Content-Type: multipart/mixed; boundary="jj22iMbXOSOVdhIOJbXeTDdfkMbDmEXao" From: Eric Blake To: Leroy Harrill , 24025@debbugs.gnu.org, GNU bug control Message-ID: <578E4FEC.6040401@redhat.com> Subject: Re: bug#24025: References: In-Reply-To: --jj22iMbXOSOVdhIOJbXeTDdfkMbDmEXao Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable retitle 24025 grep usage question tag 24025 needinfo thanks On 07/19/2016 06:11 AM, Leroy Harrill wrote: > I am not sure if this is a bug or not. Her is an example of my script t= hat > I am running. >=20 Thanks for the report. However, you haven't given us enough details to reproduce the problem you are seeing (such as the contents of file1 or of some_file.txt), nor even what you are expecting to see. You also didn't set a very informative subject line. > #!/bin/bash >=20 > rm -f x.txt > rm -f new_file >=20 > i=3D1 > wc -l file1 | sed 's/file1//g' >> x.txt >=20 > x=3D$(=20 > while [ $i -le $x ] > do > #echo "$i" > A=3D$( awk -v var=3D"$i" 'NR=3D=3Dvar {print}' file1) You can achieve the same goal of extracting a single line from a file with less typing, via: A=3D$(sed -n "$i p" file1) > #ack -k file1 file2 --match $A >> new_file > grep $A some_file.txt > ((i++)) You probably want to use "$A", not unquoted $A, even if you are absolutely sure that every line of file1 is a single word that won't be corrupted by the shell if the variable is reused unquoted. Is your intent to grep for multiple patterns in some_file.txt, where each pattern occupies a different line of file1? In which case, can't you just ditch the shell loop entirely, and write: grep -f file1 some_file.txt which will then give you a list of all lines in some_file.txt that match any of the patterns in file1 (albeit not necessarily in the same order as your shell loop would have given)? >=20 > done >=20 > grep does not appear to be grepping inside of the while loop. When I > initialize a variable directly from the command line and write the same= > script it works no problem, any help on this matter would be greatly > appreciated. You'll have to provide more details for us to be able to reproduce your situation; most likely it is not a bug in grep but a problem with your shell script, but I'll wait to close out this bug in the grep database until we have more information. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --jj22iMbXOSOVdhIOJbXeTDdfkMbDmEXao-- --WX77AjoaIEA2gPRMtqEcPTLnUkE0lB4DF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXjk/sAAoJEKeha0olJ0NqD0sH/0XGRKFR5m/gFdqIVYi8RJ48 oUlGmHGGnyKJ9gSjpn40r/6REmuVaMP/yEAnxDBBFK2lbGl+hpHhLXevkbTVD859 GLdkx+1ojH4ozrBh3/9Vi5V+XKvrSJFJ5fu7LyNqnL/1Zwebl3sEk9fl6a5vYPRh w8N/4lQ1eBpdnEMaQDG9lK31yGUpBG9dmk2QowCAyDuF9EqN9yMHwDmfxcvRdkr2 cLxbr2Ops/uSLnwDUcfV5hpG05AupQiPjOzARbCmDgi4/FJyfb+v+R+bcELw3tCo lXI9QFynkHOoLZlyyUvWKArwclp/Zbf5GhsMcUsiUzBFcsUK4abeGwifxBbE/wo= =dW40 -----END PGP SIGNATURE----- --WX77AjoaIEA2gPRMtqEcPTLnUkE0lB4DF-- From unknown Sun Aug 17 01:23:34 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Leroy Harrill Subject: bug#24025: closed (Re: grep usage question) Message-ID: References: X-Gnu-PR-Message: they-closed 24025 X-Gnu-PR-Package: grep X-Gnu-PR-Keywords: moreinfo Reply-To: 24025@debbugs.gnu.org Date: Sat, 24 Sep 2016 21:39:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1474753142-15639-1" This is a multi-part message in MIME format... ------------=_1474753142-15639-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #24025: grep usage question which was filed against the grep package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 24025@debbugs.gnu.org. --=20 24025: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D24025 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1474753142-15639-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 24025-done) by debbugs.gnu.org; 24 Sep 2016 21:38:12 +0000 Received: from localhost ([127.0.0.1]:34830 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bnueC-000438-CC for submit@debbugs.gnu.org; Sat, 24 Sep 2016 17:38:12 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:45544) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bnueB-00042u-82 for 24025-done@debbugs.gnu.org; Sat, 24 Sep 2016 17:38:11 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E267D160E3C; Sat, 24 Sep 2016 14:38:05 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id ePVp6JmxSReI; Sat, 24 Sep 2016 14:38:05 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 3BA2016111F; Sat, 24 Sep 2016 14:38:05 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id b6WlhGcWK-ex; Sat, 24 Sep 2016 14:38:05 -0700 (PDT) Received: from [192.168.1.9] (unknown [47.153.191.53]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 1FDC3160E3C; Sat, 24 Sep 2016 14:38:05 -0700 (PDT) To: Leroy Harrill From: Paul Eggert Subject: Re: grep usage question Organization: UCLA Computer Science Department Message-ID: Date: Sat, 24 Sep 2016 14:38:04 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -3.1 (---) X-Debbugs-Envelope-To: 24025-done Cc: 24025-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.1 (---) No further comment and it has been a couple of months, so closing the bug report. ------------=_1474753142-15639-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 19 Jul 2016 15:37:19 +0000 Received: from localhost ([127.0.0.1]:57456 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPX5C-000209-RK for submit@debbugs.gnu.org; Tue, 19 Jul 2016 11:37:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40178) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPTrz-0003o6-9V for submit@debbugs.gnu.org; Tue, 19 Jul 2016 08:11:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPTrq-0001On-Cm for submit@debbugs.gnu.org; Tue, 19 Jul 2016 08:11:22 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:52877) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPTrq-0001Oe-9B for submit@debbugs.gnu.org; Tue, 19 Jul 2016 08:11:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPTro-0001SY-4a for bug-grep@gnu.org; Tue, 19 Jul 2016 08:11:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPTri-0001Ng-Tq for bug-grep@gnu.org; Tue, 19 Jul 2016 08:11:15 -0400 Received: from mail-it0-x229.google.com ([2607:f8b0:4001:c0b::229]:36881) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPTri-0001Na-PD for bug-grep@gnu.org; Tue, 19 Jul 2016 08:11:10 -0400 Received: by mail-it0-x229.google.com with SMTP id f6so17584631ith.0 for ; Tue, 19 Jul 2016 05:11:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=GviIrfxIA2UvykgmjRUN+CYU4b4Z5q+aL+1WiuspdX0=; b=KxgYTpIXtlRfWlzWahCQcWnzygrTj1dGnm0gWkcxSJQJGyaOGy/z0z20BuD+SxWExE bOIr94hvXvPXYug9n8uhVoG/veYtmX+6wRgwDjTOrl50F7uBBUKE080FPvaexoYvsCIh Mx7iCjHHggz6BwU34iqQ4LjpUIJIW21UDYz7CTZ6J7TcigYWJ0yC20TegiZIF5kfP1SZ T+3Jn/iU6P6jA/+MLYoUU+BcgNgsRUbqnuB+B9Kik+vNUtfFhRXK7xVnKqMXkUmS3O2u +m09M4XfBNHDG81SEFnPO3+oPLuPphQg+qSQNKK9jlaXe7HyX6XufOeHI5FoIemGC89y 1WnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=GviIrfxIA2UvykgmjRUN+CYU4b4Z5q+aL+1WiuspdX0=; b=iqDM2ukKO0f6MjjC3HWWIF6uhSJLRrviXamaY9TJZYLd5DAkFbd57MW5TjbxffH6oX nLsGw8GgTkmo77x1gag2LWhgl938fQ8Ta5H7sqKwqA+IziFSD7ydDp4Y+ZEW0z/kcINd bEZRr4IEH3LvJTA9rnlabo3uE5eDpxPovHUdmUrpWAXM6EsVbuBZqpAkexnZBqR7suQN ddUykXcWvFENuX7lM42Sud99UGiuaEdiVItMK3xzMiWi3t7i3aNtabmszxqn/zM9I5+W ezr73uL5nzw71VQnjJi8ilBieYVRsQN5X9Yn7kAJGsu0RRKJZJ6MvjbiejBHyQCCC30/ N2PQ== X-Gm-Message-State: ALyK8tJQDHQ4MB9OuvAnJ5P1WA8JfHHTidOu8PZyUCbSl40eQjctp5J4JG7VmR21GaN6XT5j7VF4c6h44IkVdQ== X-Received: by 10.36.64.5 with SMTP id n5mr1450231ita.78.1468930269853; Tue, 19 Jul 2016 05:11:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.28.71 with HTTP; Tue, 19 Jul 2016 05:11:09 -0700 (PDT) From: Leroy Harrill Date: Tue, 19 Jul 2016 08:11:09 -0400 Message-ID: Subject: To: bug-grep@gnu.org Content-Type: multipart/alternative; boundary=001a1143da8cef3c970537fbfab1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -1.8 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 19 Jul 2016 11:37:18 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.8 (-) --001a1143da8cef3c970537fbfab1 Content-Type: text/plain; charset=UTF-8 I am not sure if this is a bug or not. Her is an example of my script that I am running. #!/bin/bash rm -f x.txt rm -f new_file i=1 wc -l file1 | sed 's/file1//g' >> x.txt x=$(> new_file grep $A some_file.txt ((i++)) done grep does not appear to be grepping inside of the while loop. When I initialize a variable directly from the command line and write the same script it works no problem, any help on this matter would be greatly appreciated. --001a1143da8cef3c970537fbfab1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I am not sure if this is a bug or not. Her is an exam= ple of my script that I am running.

#!/bin/bash

rm -f x.txtrm -f new_file

i=3D1
wc -l file1 | sed 's/file1//g' >= ;> x.txt

x=3D$(<x.txt)

while [ $i -le $x ]
do
=C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 #echo "$i"<= br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0A=3D$( awk -v var=3D"$i= " 'NR=3D=3Dvar {print}' file1)
=C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 #ack -k file1 file2 --match $A >> new_file
=C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0 grep $A some_file.txt
=C2=A0=C2=A0=C2=A0 ((i++= ))

done

grep does not appear to be grepping inside of t= he while loop. When I initialize a variable directly from the command line = and write the same script it works no problem, any help on this matter woul= d be greatly appreciated.
--001a1143da8cef3c970537fbfab1-- ------------=_1474753142-15639-1--