# Format, where n is the nth line sed -n '0~Np' # For example, to copy every 5th line of oldfile to newfile, do sed -n '0~5p' oldfile > newfile # would print lines 2, 7, 12, 17, 22, 27, …, up to the end of the file. sed -n '2~5p' oldfile