Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

(standard_in) 1: parse error

Status
Not open for further replies.

Yarka

Technical User
Jan 14, 2007
192
ES
Hi, I've a script as:
...
cat $1 | while read LINE
do
A=`echo "$LINE" | awk -F'\t' '{ print $88 }'`

B=`echo "$A + $B" | tr , . | bc | tr . ,`

done
...

When I execute this, my output is: (standard_in) 1: parse error
I don't know that it is wrong. Can somebody help me?

Thanks
 
What is the ouput produced by the following code ?
cat $1 | while read LINE
do
A=`echo "$LINE" | awk -F'\t' '{ print $88 }'`
echo "$A + $B" | tr , .
done

BTW, what is $B ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks, but B is a variable that contains differents values. For that reason I need to add to the variable B, the current value of B + the value of A
 
Are you aware you didn't answered my first question ?
 
My output when I execute your code is(Initially B = 00,00000000000):
+ 00.00000000000
+ 00.00000000000
+ 00.00000000000
.....
 
So, seems that your file doesn't have any valid 88th field ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Sorry, I've executed a wrong file. With correct file, my output is:
00.019202000 + 00.000000000
00.102403000 + 00.000000000
00.019548000 + 00.000000000
.................
 
Your output posted 16 Jan 07 18:11 is a perfectly legal input for my flavor of bc ...
 
It looks like you are just trying to add up the values of the 88th field, right? Why not use awk to do everything:

Code:
awk '
        { sub(",",".",$88); tot+=$88 }
        END { sub("\\.",",",tot); print tot }
' inputfile

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top