Get a range on line with sed (first two)

sed -n '1,2p;3q' file
Get the two first lines of a file and quit.
Sample Output
first-line
second-line

1
By: bugmenot
2021-07-16 07:29:15

What Others Think

Glad you bring this useful information, thanks a lot and you can let me share your article with others. taming io
eirawalker · 9 weeks ago
Custom packaging Life is a journey, you don’t care about the destination, you care about the scenery along the way and the mood of seeing the scenery.
rhtdbgzv · 8 weeks and 6 days ago
https://www.icheckmovies.com https://www.icheckmovies.com/login/
BarbaraMJennette · 8 weeks and 5 days ago
Taxation Solution Manuals are available for instant download with no waiting time on Speedy Grade. Get top grades at ease with our assistance.
kennethparker · 8 weeks and 4 days ago
How can you get the first lines of a file? Do you have any idea about it? If no, then please try using this code. I have used this and I am so glad to say that it worked for me at the very first attempt. Go for it without my doubt. cbd oil for sleep
charlly · 8 weeks and 4 days ago
We have sell some products of different custom boxes.it is very useful and very low price please visits this site thanks and please share this post with your friends. fanyij.yoka-yoka.jp/index_2.html
hiknigarde · 8 weeks and 2 days ago
You there, this is really good post here. Thanks for taking the time to post such valuable information. Quality content is what always gets the visitors coming. Buy big chief carts https://goowonderlandd.com/
mohsinkhatri · 8 weeks and 1 day ago
http://theworld777.com/
followerscanda · 7 weeks and 5 days ago
Thanks for sharing your information Midland driveways
Modernhomes07 · 6 weeks and 5 days ago
You are superb in Coding Shower replacement midland tx bathroom tiles midland
Modernhomes07 · 6 weeks and 5 days ago
Thanks for sharing your thoughts kitchen remodeling oakland ca custom homes Oakland
Modernhomes07 · 6 weeks and 5 days ago
Thanks for sharing your thoughts kitchen remodeling oakland ca custom homes Oakland
Modernhomes07 · 6 weeks and 5 days ago
How we will apply these codes? lawn care annapolis md landscape design annapolis md
Modernhomes07 · 6 weeks and 5 days ago
What is the benefits of ZIP file in Coding? underground sprinkler system boulder kitchen remodeling boulder
Modernhomes07 · 6 weeks and 5 days ago
Thanks for sharing https://www.brooklynlandscapingnyc.com/irrigation-systems.html https://www.brooklynlandscapingnyc.com/landscape-design.html
Modernhomes07 · 6 weeks and 5 days ago
Informative content Thanks for sharing Mortgage Lender in Austin
Modernhomes07 · 6 weeks ago
You are massive with Coding Workmen Compensation Attorney in Colorado Springs
Modernhomes07 · 6 weeks ago
A command line with two addresses separated by commas selects the entire range from the first line that matches the first address through the next line that mycardstatement
Peter478 · 5 weeks and 2 days ago
some of the commands were not visible because the thing was scrolled down. You said grep but we could not see you perform the command. We began to see the commands at cat *. Good information. Digital Marketing Agency
da32 · 2 weeks and 3 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: