Wednesday, July 13, 2016

Remove Every Other Line in a Text File

Once in a while a while you need to remove every other line in a text file. It's really easy to do with awk from the Terminal:

awk 'NR % 2 == 0' infile > outfile

There are obviously a lot of ways to accomplish this simple task but this is by far the easiest.

No comments:

Post a Comment