Hi there everyone!
This is my first post so be gentle.
I have a small bash script that is extracting 3 line every 3 lines. I got the AWK part but i cant do the loop part.
#!/bin/bash
export line=`awk 'END { print NR }' btnew`
echo $line
for i in {1..$line..3} #increment
do
echo " "
awk "NR==$i,NR==$i+2" btnew #print line n until n+2
echo " "
done
For some reason passing the total sum of lines ($line) to the increment wont work.
Any ideas?
Ouput:
9
awk: NR=={1..9..3},NR=={1..9..3}+2
awk: ^ syntax error
awk: NR=={1..9..3},NR=={1..9..3}+2
awk: ^ syntax error
awk: NR=={1..9..3},NR=={1..9..3}+2
awk: ^ syntax error
awk: NR=={1..9..3},NR=={1..9..3}+2
awk: ^ syntax error