2009-10-16

Print a particular line of a file

Saw this on commandlinefu today.

I'd been doing command | head -5 | tail -1 to print the 5th line but it makes more sense to use sed:
command | sed -n 5p

No comments:

Post a comment