Remove First n Lines of a Large Text File
Solution 1:
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
Solution 2:
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
Solution 3:
try this,
tail -n +43 dump.sql > dump_new.sql
Solution 4:
You can use Vim in Ex mode:
ex -s -c '1d42|x' dump.sql
1
move to first line42
select 42 linesd
deletex
save and close