Remove First n Lines of a Large Text File

If you want to just view the lines from the 43rd on you can use

tail -n +43 dump.sql

The + sign is important - without it, tail will print the last 43 lines instead. Alternatively with 'sed'

sed 1,42d dump.sql

If you want to really delete the first 42 lines from the original file then you can make sed make the change inplace with the -i option

sed -i 1,42d dump.sql

This seems to be the easiest:

sed '1,42d' test.sql > test2.sql

Remove lines 1-42 from test.sql and save as test2.sql


try this,

tail -n +43 dump.sql > dump_new.sql

Tags:

Command Line