using parameter max(high) or min(low) in batch file -
i want use command in batch file can find out lowest price or highest price.
batch file command :
@echo on echo "file init call ec2-describe-spot-price-history -h --instance-type t1.micro --start-time 2014-06-17t10:00:00 --end-time 2014-06-17t13:00:00 >> out.txt; echo "file written" /f "tokens=1 delims=" %%i in (out.txt) echo %%i echo "file written" echo "file done" pause
output of batch file
type price timestamp instancetype productdescription availabilityzone spotinstanceprice 0.006100 2014-06-17t10:19:16+0530 t1.micro windows us-east-1d spotinstanceprice 0.006100 2014-06-17t10:19:15+0530 t1.micro windows us-east-1a spotinstanceprice 0.006100 2014-06-17t10:19:15+0530 t1.micro windows us-east-1b
any appreciated!!
@echo off setlocal enabledelayedexpansion set "max=0.000000" set "min=9.999999" /f "skip=1delims=" %%a in (q24450870.txt) ( /f "tokens=2" %%i in ("%%a") ( if %%i gtr !max! (set "max=%%i"&set "maxline=%%a") if %%i lss !min! (set "min=%%i"&set "minline=%%a") ) ) echo max %max% in %maxline% echo min %min% in %minline% goto :eof
i used file named q24450870.txt
containing data testing.
your data contains 3 data lines prices identical, result appears nonsense. also, data presented not output of batch file claimed, represents content of datafile out.txt
without further information, it's pure guesswork goal is.
using process, unchanged other using latest data, obtained result:
max 0.006100 in spotinstanceprice 0.006100 2014-06-29t22:45:09+0530 t1.micro suse linux us-east-1b min 0.002100 in spotinstanceprice 0.002100 2014-06-29t22:45:08+0530 t1.micro linux/unix us-east-??1b
which appears max , min, sorry- can't see problem. need more info.
Comments
Post a Comment