Print a range of lines from a file using sed

Posted in Linux

sed – stream editor for filtering and transforming text

scissors-cutting

If you want to select a range of lines from a file, look no farther than your handy ‘sed’ utility. It is by definition, the perfect tool for the job!

$ sed -n '2,5p' filename

If you had a file that was just a bunch of line numbers, the output would be:

two
three
four
five

Posted by admica   @   18 January 2011
Tags : , , , , , , ,

Related Posts

0 Comments

No comments yet. Be the first to leave a comment !
Leave a Comment

Name

Email

Website

*

Previous Post
«
Next Post
»
Powered by Wordpress   |   Lunated designed by ZenVerse

Valid XHTML 1.0 Transitional