Skip to content

Latest commit

 

History

History
21 lines (14 loc) · 313 Bytes

extract-multiple-lines-from-a-file.md

File metadata and controls

21 lines (14 loc) · 313 Bytes

Extract multiple lines from a file

Using sed

Print even-numbered lines from filename:

sed -n 2~2p filename

Print odd-numbered lines from filename:

sed -n 1~2p filename

Print lines with remainder 1 when dividing by 9 (n % 9 == 1) from filename:

sed -n 1~9p filename