开发者

using 'set' variables that are gawk one liners

开发者 https://www.devze.com 2023-01-09 03:18 出处:网络
i am writing a short bat file that contours a xyz file with GMT utilities (gener开发者_JS百科ic mapping tool) i want to read the max and min file and use it later in the bat file what i did is

i am writing a short bat file that contours a xyz file with GMT utilities (gener开发者_JS百科ic 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


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

for /f %%a in ('your gawk command') do (
  set var=%%a
)
0

精彩评论

暂无评论...
验证码 换一张
取 消