🔍 See Original Question on Ask Ubuntu 🔗
Which is faster to delete first line in file... sed or tail?
December 20, 2016
Edited: April 13, 2017
November 24, 2022
Copy to clipboard: false
In this answer (How can I remove the first line of a file with sed?) there are two ways to delete the first record in a file:
sed '1d' $file >> headerless.txt
** —————- OR —————-**
tail -n +2 $file >> headerless.txt
Personally I think the
tail option is cosmetically more pleasing and more readable but probably because I’m sed-challenged.
Which method is fastest?