5

Syntax error piping to bc on command line - works when assigned to var

view full story
linux-howto

http://www.unix.com – I have a script which outputs some timing data a line at a time. There are approx. 10 lines echoed, each line looks something like this: Code: 0.741 http://checkip.dyndns.org 94.170.119.226 Since I needed to add all the values in the first column, I piped the output to grep, matching and printing the first numerical column, then piped it on to tr to replace new lines with '+', then piped to sed to replace the final '+' with nothing, and finally to bc to add the values. Then bc gave me a stdin syntax error - damn it, maybe I'm not quite so clever as I thought I was. :) On examining the c (HowTos)