You're replying to a comment by Prasath Nagaraju.

Prasath Nagaraju Permalink
November 03, 2015, 19:21

Regarding Point 11,

awk '{ for (i = 1; i <= NF; i++) s = s+$i }; END { print s+0 }'

It works the same for me as

awk '{ for (i = 1; i <= NF; i++) s = s+$i }; END { print s }'

But if I understand your explanation...I thought I should get only ORS.

-------------------
Also notice how it calls "print s+0" and not just "print s". It is necessary if there are no fields. If there are no fields, "s" never comes into existence and is undefined. Printing an undefined value does not print anything (i.e. prints just the ORS). Adding a 0 does a mathematical operation and undef+0 = 0, so it prints "0".
---------------------

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

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

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