2

I'm trying to add a column for each line together, and I do it like this:

awk '{s+=$2} END {print s}'

Now, when I have the final sum, s, I want to subtract the second column of the first line, like this:

awk '{s+=$2} {a= COLUMN 2 OF FIRST LINE } END {print s - a}'

How would I do that?

1 Answer 1

2

Just exclude the first line:

awk 'FNR>1{s+=$2};END{print s}'
0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.