Computing.Net > Forums > Programming > Batch parse

Batch parse

Reply to Message Icon

Original Message
Name: momchil
Date: October 8, 2007 at 03:31:09 Pacific
Subject: Batch parse
OS: windows XP SP2
CPU/Ram: 1000/500
Comment:

Hi, I need to parse a text file like this one

process.exe; process name
process1.exe; process1 name
...........

so I need to asign a name for a process

I need to search another text file for a process and if exists to tell the application name using this process.

the thing I do not get is how to seperate the words with the (;) and put them in different variables %process% and %process_name%.

Thank you


Report Offensive Message For Removal


Response Number 1
Name: Mechanix2Go
Date: October 8, 2007 at 04:27:56 Pacific
Reply: (edit)

@echo off
setLocal EnableDelayedExpansion

for /f "tokens=1-2 delims=;" %%a in (myfile) do (
set process=%%a & set process_name=%%b
echo !process! !process_name!
)



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

M2



Report Offensive Follow Up For Removal

Response Number 2
Name: momchil
Date: October 8, 2007 at 04:39:21 Pacific
Reply: (edit)

You wrote the CMD right? :)


Thank you


Report Offensive Follow Up For Removal

Response Number 3
Name: momchil
Date: October 8, 2007 at 04:51:48 Pacific
Reply: (edit)

sorry for the spam but .. still .. one more issue,each process should be searched in a third file and if exist echo process name

smt like
for /f "tokens=1-2 delims=;" %%a in (myfile) do
( type third.file | find ^/%%a )
if errorlevel 1
echo process name ( %%b )

else
goto somewhere


Report Offensive Follow Up For Removal

Response Number 4
Name: Mechanix2Go
Date: October 9, 2007 at 09:08:27 Pacific
Reply: (edit)

not clear what's needed


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

M2



Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Batch parse

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 3 Days.
Discuss in The Lounge