Command to capture certain word only

August 2, 2009 at 19:33:02
Specs: Windows XP

I have this file alert.txt with these words:

Subject: Syslog Alert Notification

I would like to capture the text from subject and to and create a new txt file.

The new file will look something like this.

To: 6591234567

Syslog Alert Notification

Appreciate if anyone can help me on this.

See More: Command to capture certain word only

Report •

August 3, 2009 at 22:38:32
@echo off > newfile & setLocal enableDELAYedexpansion

set N=
for /f "tokens=* delims= " %%a in (alert.txt) do (
set /a N+=1
set v!N!=%%a

set v1=!v1:Subject: =!
for /f "tokens=1 delims=@" %%a in ("!v2!") do (
set v3=%%a

echo !v3! >> newfile & echo. >> newfile
echo !v1! >> newfile

If at first you don't succeed, you're about average.


Report •

August 4, 2009 at 02:26:44
Hi, great, Thanks for your help..

Report •

Related Solutions

Ask Question