Computing.Net > Forums > Disk Operating System > The 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.

The FIND command

Reply to Message Icon

Name: Tony
Date: May 20, 2003 at 13:31:01 Pacific
OS: 2000
CPU/Ram: p2
Comment:

Hey guys.

I'm having a problem with the FIND command.

Say I want to find the string "2000" in a file of numbers, how can I just locate this number rather than also locating "20000" "200000" etc...

Any help would be fantastic.



Sponsored Link
Ads by Google

Response Number 1
Name: FishMonger
Date: May 20, 2003 at 20:20:18 Pacific
Reply:

try this:

find " 2000 " filename


0

Response Number 2
Name: IVO
Date: May 21, 2003 at 01:51:13 Pacific
Reply:

Better you try

Type FileName | Find /V "20000" | Find /V "200000" | Find /V "2000000" | Find "2000"

The above script will exclude the strings 20000, 200000, 2000000. If this doesn't suffice post again


0

Response Number 3
Name: FishMonger
Date: May 21, 2003 at 07:07:40 Pacific
Reply:

Do you want to find 2000 only if it's a whole number and not part of a larger number? If you want to find lines like this:

2000
652000
200098

but not

5620000
2000000

then this is the best method

find "2000" file.txt | find /V "20000"


0

Response Number 4
Name: FishMonger
Date: May 21, 2003 at 07:10:17 Pacific
Reply:

My first sugestion of:

find " 2000 " filename

would only find 2000 if it was a whole number.


0

Response Number 5
Name: Tony
Date: May 21, 2003 at 10:09:00 Pacific
Reply:

Hi.

Thanks for the suggestions. I'm not sure if I was being clear enough so here goes: I have a number of word files all containing unique numbers. I require a way of identifying which word file a specific number is in. I have a batch file where the user enters any number to search for:

find /i /c "%1" "c:\path\path\path\*.doc"

so say a user enters a five digit number, this number may also feature within a six digit number. This would give me more than one file the number could be in. Is there a way around this problem? I.E. if I wanted to find the word file containing number 321, this number would also be found in any files with numbers such as 503216, 3210 and so on.


0

Related Posts

See More



Response Number 6
Name: Secret_Doom
Date: May 21, 2003 at 16:59:56 Pacific
Reply:

This will do it accurately:

FINDSTR "^%1[^0-9] [^0-9]%1[^0-9] ^%1$ [^0-9]%1$" "c:\path\path\path\*.doc"

That will only match the string on %1 if it is surrounded by non-numeric characters (or by line breaks).

The external command FINDSTR is only avaliable by default on NT systems.

-- Leonardo Pignataro - Secret_Doom --

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

___________________________________________________________________________________


0

Sponsored Link
Ads by Google
Reply to Message Icon






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: The FIND command

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

Find command www.computing.net/answers/dos/find-command/5987.html

How to use the AT command www.computing.net/answers/dos/how-to-use-the-at-command/11130.html