I'm writing a small bash script to treat my data.
In part of the script, I need to use the data, which exists in my raw data, to generate a new value.
However, the script I wrote does not work.
The terminal gives me the following error
")0.192500rror: invalid arithmetic operator (error token is "
the value of each variable is: inc= 0.0200000, str= -0.192500, pts= 1024,
My script is as follows:
for i in *.TXT; do
inc=$(sed -n '/^#XPERCHAN/ p' $i | sed 's/[A-Z:# ]//g')
str=$(sed -n '/^#OFFSET/ p' $i | sed 's/[A-Z:# ]//g')
pts=$(sed -n '/^#NPOINTS/ p' $i | sed 's/[A-Z:# .]//g')
lst=$(( ($pts-1)*$inc+$str))
echo $lst
done
Please help me out here. Thanks!