tags:

views:

49

answers:

1

i am writing a short bat file that contours a xyz file with GMT utilities (generic mapping tool) i want to read the max and min file and use it later in the bat file what i did is

set max_color=gawk "BEGIN {max = 0} {if ($3>max) max=$3} END {print max}" %file%
set min_color=gawk "BEGIN {min = %max_color%} {if ($3'<'min) min=$3} END {print min}" %file%

but when i try reading it later

makecpt -Crainbow -T%min_color%/%max_color%/10 > conc.cpt

instead of reding the value it has the whole gawk one liner
how can i set a value

+3  A: 

use a for loop to get the results of the gawk command, eg

for /f %%a in ('your gawk command') do (
  set var=%%a
)
ghostdog74
thanks! can i get it to use 2 vars?
eliavs
use %%b, %%c etc, depending on what you return back from gawk.
ghostdog74