Monday 29 December 2008

print even or odd numbered lines

Print the even-numbered lines in the data file:

awk 'NR % 2 == 0' data

If you use the expression `NR % 2 == 1' instead, the program would print the odd-numbered lines.

No comments:

Post a Comment

Tweets by @sriramperumalla