I'm having a problem adding numbers from a file and displaying it on the screen.
The file is like this,
121
213
2354
23
5878
546
65
Now, I want to add up these numbers and display.
I "dont" want to use "cat file | while read var" loop because it is slow and the variable created inside it isn't accessible from outside the loop.
Please suggest me ways.
Also, if you'd help me, suggest me the fastest way to read a file full of file paths (newline separated) and calculate their total file size, I've used command " cat file | xargs du " but it says the list of arguments is too large.
Thanks.



Adv Reply






Bookmarks