commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
tail -n X | head -n 1
prints a specific line, where X is the line number
There is 1 alternative - vote for the best!
this method should be the fastest
Prints the 4th line and then quits. (Credit goes to flatcap in comments: http://www.commandlinefu.com/commands/view/6031/print-just-line-4-from-a-textfile#comment.)
using tail first won't do it because tail counts from the bottom of the file. You could do it this way but I don't suggest it
d --> delete
!d ---> delete others
If you can do better, submit your command here.
You must be signed in to comment.