Alvin Alvin - 8 months ago 52
Linux Question

Get the line count from 2nd line of the file

How do I get the line count of a file from the 2nd line of the file, as the first line is header?

wc -l filename


Is there a way to set some condition into it?

Answer

Use the tail command:

tail -n +2 file | wc -l

-n +2 would print the file starting from line 2