sed (GNU)
sed '0~4G'
man sed explica como:
first ~ step
Match every step'th line starting with line first. For example, ''sed -n 1~2p'' will print all the odd-numbered lines in the input stream, and the address 2~5 will match every fifth line, starting with the second. first can be zero; in this case, sed operates as if it were equal to step. (This is an extension.)
sed (outro)
Curto (feio por 100 linhas):
sed 'n;n;n;G'
Ou , Conte novas linhas:
sed -e 'p;s/.*//;H;x;/\n\{4\}/{g;p};x;d'
Ou, para ser mais portátil, escrito como (remova comentários para algumas versões do sed):
sed -e ' # Start a sed script.
p # Whatever happens later, print the line.
s/.*// # Clean the pattern space.
H # Add **one** newline to hold space.
x # Get the hold space to examine it, now is empty.
/\n\{4\}/{ # Test if there are 4 new lines counted.
g # Erase the newline count.
p # Print an additional new line.
} # End the test.
x # match the 'x' done above.
d # don't print anything else. Re-start.
' # End sed script.
awk
Provavelmente:
awk '1 ; NR % 4 == 0 {printf"\n"} '