i am on a unixlike system. i have a file of numbers, one on each line. i want the sum of these numbers. how do

@ky0ko Here are a couple of methods in bash, bc, and awk, which I *think* could be adapted to one on each line: stackoverflow.com/questions/25

You could also go the C route, open the file, read each line into one array (char**), use atoi (or atof or whatever) to get another array of actual numbers, then sum over that array.

Follow

@ky0ko Actually, now that I think about it, assuming you know what your data is, you could just use fscanf instead of going the read into one array then atoi into another route

Sign in to participate in the conversation
Computer Fairies

Computer Fairies is a Mastodon instance that aims to be as queer, friendly and furry as possible. We welcome all kinds of computer fairies!