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.