Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

May 022010

Remove specified lines from a file using sed


Assume your have a file text.txt contains 100 lines, if you want to remove the lines 20-30, what you need is sed:

# sed '20,30d' text.txt

That's is easy.

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>