Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

2 Answers

up vote 6 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
share|improve this answer
4  
or ed file1 <<< $'1d\nw\nq' – glenn jackman May 16 '11 at 14:58
$ tail -n +2 <<< $'1\n2\n3'
2
3
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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