Computing.Net > Forums > Programming > batch file to filter text in file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

batch file to filter text in file

Reply to Message Icon

Name: David Mendoza (by jdavid.mendoza)
Date: June 22, 2006 at 10:14:21 Pacific
OS: WinXP Prof SP2
CPU/Ram: 3.2 / 512
Product: HP
Comment:

Is there a dos command to filter text in files??..

example txt

Agente,Nombre
47,David Mendoza

this information is in the txt file, what i would like to do is filter the text and end up only with the number, in this case the ending result would be "47", this i would be able to run it as a variable to run an extra process, thanks in advance

note: also, i found and external program that does this, but since i only have the source code, and haven't been able to compile it and u believe u can do it, i'll send u the file on request it's on C++,

Here i go again...



Sponsored Link
Ads by Google

Response Number 1
Name: dtech10
Date: June 22, 2006 at 14:11:41 Pacific
Reply:

Hi David
If its always in the same format and the number is first and on the last line.

@echo off
for /f "tokens=1 delims=," %%a in (Example.txt) do set Num=%%a
echo %Num%


0

Response Number 2
Name: David Mendoza (by jdavid.mendoza)
Date: June 23, 2006 at 09:34:42 Pacific
Reply:

Excellent it worked out just great :)

Here i go again...


0

Response Number 3
Name: mala_un
Date: July 14, 2006 at 00:26:34 Pacific
Reply:

what if

Microsoft Windows 98 (Version 4.10.2222)
i wanted the "98" to be directed to filename1.bat

and also

Microsoft Windows XP (Version 5.1.2600)
i wanted the "XP" to be directed to filename2.bat

please help me


0

Response Number 4
Name: Mechanix2Go
Date: July 14, 2006 at 03:26:27 Pacific
Reply:

Not quite clear here.

You want 98 [or XP] to go into an existing bat?

Or what?


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

M2


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: batch file to filter text in file

Batch to replace text in text file www.computing.net/answers/programming/batch-to-replace-text-in-text-file/19166.html

batch script to parse text file www.computing.net/answers/programming/batch-script-to-parse-text-file/16793.html

Batch file to replace text in file www.computing.net/answers/programming/batch-file-to-replace-text-in-file/20070.html