Hello again,
I'm trying to loop through columns where the last column is a stored value. For example:
So, I want to use $mycolumn:
However, when I try:
I get no output.
Would you please help?
I'm trying to loop through columns where the last column is a stored value. For example:
Code:
$ echo $columns
1a 2b 3c 4d 5e 6f 7g 8h 9i 10j 11k 12l 13m 14n 15o 16p
$ echo $mycolumn
12
$ echo $columns | awk '{for(i=8;i<=12;++i)print $i}'
8h
9i
10j
11k
12l
So, I want to use $mycolumn:
Code:
echo $columns | awk -v n=$mycolumn '{print $n}'
12l
However, when I try:
$ echo $columns | awk -v n=$mycolumn '{for(i=8;i<=$n;++i)print $i}'
I get no output.
Would you please help?