Do you have a method to quickly remove the first line of a file in bash shell ? I mean using sed or stuff like that.

link|improve this question

feedback

2 Answers

up vote 5 down vote accepted

sed:

sed -i 1d file

awk:

awk 'NR > 1' infile > outfile

line + cat:

(line >&- ; cat > outfile) < infile

bash built-ins:

while read -r; do (( i++ )) && echo "$REPLY" >> outfile; done < infile; unset i
link|improve this answer
3  
or ed file1 <<< $'1d\nw\nq' – glenn jackman May 16 '11 at 14:58
feedback
$ tail -n +2 <<< $'1\n2\n3'
2
3
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.