Create a Batch file to extract data

Hewlett-packard Nc6400 t5600 14.1 1024/8...
November 26, 2009 at 01:16:55
Specs: Windows XP
I have a txt file that contains data in the following format:

I would like to create a batch file that extracts the data labelled "C13**" to a file called output1.txt. Then I would like to extract the data labelled "C15**" to a file called output2.txt.

I thought a batch file might work here but am open to other suggestions on how to do this.
I would appreciate any help / advice that you could give me.

See More: Create a Batch file to extract data

Report •

November 26, 2009 at 13:06:34
hi mate, hope this helps.
type nul> yournewfile.txt
@echo off & cls & setlocal enabledelayedexpansion
for /f "tokens=* delims=" %%a in ('find /i "c13" ^< "yourfile.txt"') do (
set line=%%a
set line1=!line:~-5!
echo !line1!>> yournewfile.txt
start yournewfile.txt

Report •

November 26, 2009 at 21:44:23
but not understood if you want whole line (all data) or just the "C1" part. if you want whole lines:

@echo off
type test | find /i "c15" > c15.txt
type test | find /i "c13" > c13.txt

this is ASSuming that the data doesn't contain C15 or C13
anywhere else in the structure other than where you showed.

Report •

November 27, 2009 at 10:29:50
Far more simply:

find "C13" < myfile > output1.txt
find "C15" < myfile > output2.txt

Helping others achieve escape felicity


Report •

Related Solutions

Ask Question