I have a file which looks like this:
1
2
AA
4
5
AA BB
7
8
AA BB CC
10
11
AA BB CC DD
I am using awk to extract only every nth
line where n=3
.
>>awk 'NR%3==0' /input/file_foo >> output/file_foobar
The output is appearing in a single line as:
AA AA BB AA BB CC AA BB CC DD
.....and so on
I want it to appear as:
AA
AA BB
AA BB CC
AA BB CC DD
I tried using \n
, printf
with \n
, and so on but it doesn't work as I expect. Please advise.