GNU bug report logs - #24025
grep usage question

Previous Next

Package: grep;

Reported by: Leroy Harrill <cdideveloper016 <at> gmail.com>

Date: Tue, 19 Jul 2016 15:38:01 UTC

Severity: normal

Tags: moreinfo

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Leroy Harrill <cdideveloper016 <at> gmail.com>
To: 24025 <at> debbugs.gnu.org
Subject: bug#24025: 
Date: Tue, 19 Jul 2016 08:11:09 -0400
[Message part 1 (text/plain, inline)]
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=$(<x.txt)

while [ $i -le $x ]
do
            #echo "$i"
         A=$( awk -v var="$i" 'NR==var {print}' file1)
        #ack -k file1 file2 --match $A >> 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.
[Message part 2 (text/html, inline)]

This bug report was last modified 8 years and 300 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.