Alvin Alvin - 1 year ago 87
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 Source

Use the tail command:

tail -n +2 file | wc -l

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download