Sunday, May 20, 2012

Delete N number of lines from a file on Linux

$ sed -i 'starting_line_no, end_line_no d' file_name

$ sed -i '1,5d' test.txt

The above command will delete first 5 lines from 'test.txt' file.

4 comments: