@echo off if _%1==%1_ goto ERROR if %1==trim2.csv goto ERROR if not exist %1 goto ERROR rem CONVERT TIME ZERO TO us, THEN PREFIX ns, us AND ms TIMES WITH 000 sr "/h0 s," "0.000 us," <%1 |sr "/h/+0/!/#/d/+1/! /ls," "/d0000/d1" >trim2.csv rem CONVERT ns TO us PLUS PREFIX, THEN CONVERT us TO ms PLUS PREFIX sr InSeconds.csv rem CONVERT ms TO s, THEN DELETE LEADING ZEROS FROM TIMES sr trim2.csv rem REMOVE PICOSECONDS=ZERO FROM TIMES AND DELETE ENGINEERING UNIT s sr InSeconds.csv goto END :ERROR echo Command usage: InSeconds.BAT FILENAME echo Converts the inconsistent times in Agilent logic analyzer .CSV echo output files to seconds. If the input "FILENAME" looks like: echo "Time","FPGA_A429_TX3_H","FPGA_A429_TX3_L" echo -8.388608 ms,1,1 echo -999.446 us,1,1 echo -374 ns,1,1 echo 0 s,1,1 echo 626 ns,1,1 echo 999.344 us,0,0 echo 830.453038 ms,0,0 echo then the output file "InSeconds.csv" will look like: echo "Seconds","FPGA_A429_TX3_H","FPGA_A429_TX3_L" echo -.008388608,1,1 echo -.000999446,1,1 echo -.000000374,1,1 echo .000000000,1,1 echo .000000626,1,1 echo .000999344,0,0 echo .830453038,0,0 :END