Computing.Net > Forums > Disk Operating System > DOS Help with Find command

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.

DOS Help with Find command

Reply to Message Icon

Name: PERU
Date: July 17, 2003 at 13:12:35 Pacific
OS: Win NT/2K
CPU/Ram: Intel Pentium
Comment:

All,

I was trying to using a find DOS command on a file and want results in a way such that.

Say I have a file Test.txt as follows

PERU M008 JAMES DOG
JAPA M007 ROMES PIG


I am using the command:

find "PERU" Test.txt > Testout.txt

Testout.txt will have

PERU M008 JAMES DOG

But my result should return

M008 JAMES DOG

without "PERU"

Could you please help me on this.



Sponsored Link
Ads by Google

Response Number 1
Name: Secrett_Doom
Date: July 17, 2003 at 13:57:53 Pacific
Reply:

If it's a single line, you can get it to a variable instead of a file, and you can take out the first 5 characters from it:

for /F "tokens=*" %%S ('FINDSTR "PERU" test.txt') do set string=%%S
set string=%string:~5%

But it it will be more than that, you'd better replace the string PERU for no string at all, on the file itself. Read my faq:

FAQ #19 - Replace a string on a file automatically

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br

____________________________________________________________________________


0
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 Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: DOS Help with Find command

Need help with AT commands www.computing.net/answers/dos/need-help-with-at-commands/11462.html

I Need Help with the FIND Command www.computing.net/answers/dos/i-need-help-with-the-find-command/12687.html

Need souncard help with DOS www.computing.net/answers/dos/need-souncard-help-with-dos/12286.html