1,A
2,B
3,C
4,D
5,E
6,F
7,G
8,H
9,I
10,J
11,K
12,L
13,M
14,N
How do I print row 4 first and then the 9th row and then the 14th row using awk? I want to first print the 4th row and then continue printing every 5th row after the 4th row, until the end of the file. I tried this:
awk '{if(NR==4 || (NR>4 && NR==NR+7)) print $0}' file
But this doesn't work. Any help is appreciated.
The output should be:
4,D
9,I
14,N