I'd like to randomly select a line after a given number of lines. For example here's my input:
8 blue
8 red
8 yellow
8 orange
3 pink
3 white
3 cyan
3 purple
1 magenta
1 black
1 green
1 brown
and with random selection a line from every four lines, my output would be:
8 orange
3 pink
1 green
The best I've come up with is:
awk '!(NR%4){a=NR+4};NR<=a|"shuf -n 1"'
but it doesn't work.