Text Data Extraction

August 18, 2009 at 15:25:27
Specs: Windows XP
I found the code
@echo off > new.txt
for %%T in (*.txt) do find "A10:@" < %%T >> new.txt

Wish to look in a directory at all the .txt files and extract the lines within the file that starts with A10:@.

For some reason when I run the above code it doubles the lines in the new text file. when the old file contains 4 lines which starts with A10:@ the new file created has 8.

Utilmatley I really only want the first 16 characters after the @ symbol not the entire line. The 17th character after the @ is always a * so I could just extract the data between A10:@ and * abd write it to a file.

The following code almost worked

@echo off
setLocal EnableDelayedExpansion
for /f "tokens=2 delims= " %%a in ('find "A10:@" ^< myfile') do (
echo %%a

Thanks in advance.

See More: Text Data Extraction

Report •

August 18, 2009 at 16:07:04
Post this in the Programming Forum for more help... link pn the right


Report •
Related Solutions

Ask Question