title: Read x,y from file columns, convert to r, θ and save in different columns same file
body: <p>I have a file with 17294 particles and for each particle I have x,y,z in three 3 columns (x,y,z). Z=0 for every particle so the problem is 2-D. I want to convert the Cartesian coordinates to polar and save them in the same file (4th column for r and 5th column fro θ). To begin with I tried to convert x,y only to r and save it in different file, here is my code:</p>
  
  <pre class="lang-sh prettyprint-override"><code>while read x y z; do
     r=$(( $x*$x+$y*$y )) | bc
     r=$( echo "scale=3;sqrt($r)" | bc -l )
     echo $r &gt;&gt; rTh.dat
  done &lt; TP_xyz.dat
  </code></pre>
  
  <p>I get an error like this :</p>
  
  <pre class="lang-sh prettyprint-override"><code>./xyToRTh.sh: line 6: 
  2.0059765754498855*2.0059765754498855+1.8715584950948734*1.8715584950948734 : syntax error: invalid arithmetic operator
  (error token is ".0059765754498855*2.0059765754498855+1.8715584950948734*1.8715584950948734 ")
  (standard_in) 1: syntax error
  </code></pre>
  
  <p>Here is the form of the particles data (7 first particles):</p>
  
  <pre><code> 2.2573374744307952        1.2118823295321732        0.0000000000000000     
   1.5877269404049552        2.0106312183498303        0.0000000000000000     
   -2.3002441197354102       0.99907356258704294        0.0000000000000000     
   0.92072919084479099        2.3995221040664498        0.0000000000000000     
   0.67981176735521276        2.4186181486021687        0.0000000000000000     
   2.1297085617142675       -1.3495832035165336        0.0000000000000000     
   -6.1805611083798166E-002  -2.4993700771441976        0.0000000000000000
  </code></pre>
  
  <p>Any help would be useful. Thank you in advance.</p>