Sum the numbers on standard in Consider a stream/file with one integer per line. For example:

123
5
99


Your code should output the sum of these numbers, that is 227.

The input format is strictly one integer per line. You cannot, for example, assume the input is on one line as an array of integers.

You can take input either from STDIN, in form of a filename, or a file with a name of your choice; you can choose which one. No other ways of getting input are allowed.

The input will contain at least one integer. You can assume all integers are non-negative and that their total sum is less than 232.
Bash + coreutils, 16 bytes

xargs|tr \  +|bc


Try it online!

There are two spaces after the \. This works for negative numbers as well.

Explanation:

xargs             # known trick to turn newlines into spaces, while adding a
                  #trailing newline when printing the result (needed for bc)
|tr \  +          # turn spaces into '+'s
|bc               # calculates the sum


You may wonder why tr \\n +|bc isn't better, since it turns newlines directly into '+'s. Well, that has 2 unforeseen errors:


if the input has a trailing newline, then it is converted to a trailing '+', hence there is no number after it to perform the addition
and the most weird issue is that bc requires a trailing newline after the input, but you just replaced all of the input newlines with '+'s.