Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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.

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____________________________________________________________________________

![]() |
![]() |
![]() |

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