Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google site




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 01-17-2008
RichieFondel RichieFondel is offline
Registered User
 

Join Date: Jan 2008
Posts: 7
Trouble with awk

This is probably a fairly simple question but I cant seem to get it to work.

Im trying to multiply an entire column in a file by a variable in my bash script but just cant seem to get it to work with awk.

Here is what I'm trying

$varr is some value
$line is my file


awk '{print $1,$2*$varr}' $varr "$line"

It seems to print the $2*$varr 'th column instead of multiplying the $2 column by $varr


I've also tried such things as awk -v $varr the the rest of the stuff above, nothing seems to work.?
Sponsored Links