Reputation: 631
I'm trying to confirm or not if I am able to remove a header.
Let's say I have a file data.gz:
This line is the header Data
Data line 1
Data line 2
Data line 3
Data line 4
Data line 5
I want to remove the first line before I do a regular expression
gunzip -c data.gz | grep -v '^This line is the header data$' | grep -o 'Data' | sort | uniq -c
Will this remove the header before I do second grep (regular expression) for data? Is there a better method for removing a header in a pipeline?
Upvotes: 1
Views: 1896
Reputation: 76959
Yes! The tail
command can skip lines counting from the beginning:
$ seq 1 3 | tail -n+2
2
3
Upvotes: 1