The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-24-2007
maskot maskot is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 20
guess the fault :)

I really cant understand whats wrong with this:

File looks like this:
55 11

Code:
cost=30
a= cut -c9-12 File
let a=${a}+${cost}
echo $a

The answer echo should echo 11+30(cost) however the output looks like this:
11
30

And also is there anyway to grep $2 without awk? or maybe awk grep $2?
wouldnt mind get this loop to work instead
for i in cut -c1-12 awk ' $2 ~ "^[0-9]" && $2 > 0 {$2='$i'} ' 5 `