commands to manipulate textfiles

K

Ketaki

i have a file abc.txt which has following 3 lines of text:

62WE-0003:RIDGWARO:08/04/2003 05:33
04349-338 APANEL MOUNTING SWITCH
12252-832 NEWRAW MAT SHEET 1/8 5052

i want to extract only "62WE-0003" from the first line of
abc.txt and store it in another text file def.txt and then
delete the 1st line completely from abc.txt. i want to do
this through windows 2000 commands so that i can put them
in a batch file and it can be run automatically. i am
unable to figure out which commands would work to
accomplish this.
How can i do that?

Thanks,
Ketaki
 
T

Tom Lavedas

Here is one way I can think of ...

@echo off
for /f "delims=:" %%a in (
'fc %1 "%~f0" /lb1^|find "/"') do (
set Data=%%a)
echo %%a > def.txt
find /v "%Data%" < %1 > tmp.txt
del %1
copy tmp.txt %1 > nul

Tom Lavedas
===========
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top