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:
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
There are 5 alternatives - 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.)
d --> delete
!d ---> delete others
Perl version - just for completeness sake ;)
If you can do better, submit your command here.
You must be signed in to comment.