bash grep every second line code example Example: extract every nth line using sed linux fedora $ sed -n '1p;0~3p' input.txt Line 1 Line 3 Line 6