Batch - Extract data form files

April 8, 2009 at 05:20:46
Specs: Windows Vista 32 Premium SP1
Hey guys, i need some help with this.

I have some files called frame01.txt, frame02.txt, etc..
here's an exemple of what they look like (the number of lines are random in each files):

464 ET_MOVER
467 ET_MOVER
502 ET_OID_TRIGGER
506 ET_MOVER
545 ET_MOVER
646 ET_MOVER
debugSnapEnts: 16 entities in snap for serverTime 87384200
Dumped console text to Cam\Frames\frame01.txt.

Some of my .txt do not have any numbers, I would like to echo "Failed", or something, to know that it.. well, failed.
so here's the code I'm using, it works, but it doesn't output the "failed"...

for /f "usebackq tokens=8" %%a in (`type frame*.txt^|find "serverTime"`) do (
    if "%%a"=="" (echo FAILED) else (echo %%a)
    ) >> framesList.txt

If someone could point me in the right direction, that would be very nice.
Thanks.

See More: Batch - Extract data form files

Report •


#1
April 12, 2009 at 02:13:24
try use token=1,8, then instead of %%a you now refer it as %%b

Report •
Related Solutions


Ask Question