I have a code here , which should display lines 6,10,14,18,35 of a text file
#!/bin/ksh
line[1]=6
line[2]=10
line[3]=14
line[4]=18
line[5]=35
for i in 1 2 3 4 5
do
val=`echo ${line[$i]}`
act=`awk 'NR~/^($val)$/' db_CHECKOUT.txt`
done;
This code is not working. The purpose of the line below is to grep for line 6 from the file db_CHECKOUT.txt. It works fine when it has a number bt when i replace a variable "%val" in the above code its doesnt give any result
awk 'NR~/^(6)$/' db_CHECKOUT.txt