You're viewing a comment by Shoilen and its responses.

Shoilen Permalink
October 21, 2011, 11:35

I want to get the line count of a file, excluding the first line. How can I achieve it using sed? File content:

EMP_ID | DEPT_NAME
6965828|Physics One
7510197|Physics One
4789042|Physics One
7991528|Physics One

I tried
#sed -(n-1) '$=' Myfile
the result is 5 however I should be 4.

Comment Responses

pandeeswaran Permalink
February 05, 2012, 14:50

This is the way you want i guess:
pandeeswaran@ubuntu:~/training$ cat Myfile
EMP_ID | DEPT_NAME
6965828|Physics One
7510197|Physics One
4789042|Physics One
7991528|Physics One
pandeeswaran@ubuntu:~/training$ sed -e '1d' Myfile|sed -n '$='
4

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "antispam_95": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.