Batch compare numbers in files

September 28, 2010 at 12:58:17
Specs: Windows 7, 2x2.8 4GB
Hi! im trying to make batch script that will compare numbers in two different files

file.txt
-------------------------------------------------------------------
9.9 // these number are contained in file

compare with Value2 from value.txt

value.txt
-------------------------------------------------------------------
Value1=10.0
Value2=15.7

...if the number from file.txt is smaller than value2 than start negative.exe....else print the number is greater

pls i need quick response thanks =)


See More: Batch compare numbers in files

Report •


#1
September 28, 2010 at 16:34:07
Batch probably won't do for floating point numbers.


=====================================
Helping others achieve escape felicity

M2


Report •

#2
September 28, 2010 at 18:44:14
download gawk for windows then do this

C:\test>gawk -F"=" "FNR==NR{n=$0}NR>FNR && /Value2/{ if($2>n){ cmd=\"negative.exe\" ;system(cmd) }  } " file value.txt

GNU win32 packages | Gawk


Report •

#3
September 29, 2010 at 23:44:01
Thanks ghostdog it worked perfectly =))

Report •

Related Solutions


Ask Question