🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #6946

Re: "finding" text in files

#6946
From: Michael McNeil
Date: Tue, 04 Jun 1991 02:48
48 lines
2396 bytes
ted@helios.ucsc.edu (Ted Cantrall) writes:
>We are getting ready to go from DOS 3.3 to 4.01 so we can use our larger
>disks more effectively. As a result of having many partitions, there are
>many batch files that refer to E: or F: that will have to be modified when
>those partitions go away. So the question is:
> Is there any way to use DOS filters (like FIND) to print a list of the
>batch files that contain an "E:" or an "F:"? The problem with useing FIND
>directly is that it won't take wild cards so I'd have to manually feed it
>all the batch file names. (computers are suppose to be smart) :-)

I find the DOS "FIND" utility useful, even if it can't take wildcards,
by calling it from a batch file (which I call "GREP.BAT") which *is*
capable of utilizing wildcards -- through the "FOR" batch file syntax.  
Simply put a "FOR" line in your batch file, calling "FIND" like this:

	FOR %%F IN (%2 %3 %4 %5 %6 %7 %8 %9) DO FIND "%1" %%F

Then call "GREP" passing it up to eight *wildcarded* filenames, like so:

	GREP string FILE1 ... FILE8

For example,

	GREP E: D:\BIN\*.BAT

will locate all "E:" strings in batch files within the given directory.

Actually, I like putting a "SHIFT" before the "FOR" so as to pick up
one more parameter, for a total of nine.  If you do this, change the
"FOR" to take cognizance of the additional zeroth parameter, viz.:

	SHIFT
	FOR %%F IN (%1 %2 %3 %4 %5 %6 %7 %8 %9) DO FIND "%0" %%F

>Please reply by E-Mail as I am way behind in reading news.
>   Thanks to all (any) who answer...		
>
>-ted- ted@helios.ucsc.edu

--
Michael McNeil			Mail: Michael_McNeil@3Mail.3Com.COM
3Com Corporation		News: michaelm@molehill.ESD.3Com.COM
Santa Clara, California		Work telephone: (408) 492-1790 x 5-208

	If I could remember all those names [referring to
	the growing population of subatomic particles],
	I would have been a botanist.  
		Enrico Fermi, early 1950s
Technical Details
Message-ID: <michaelm.676003716@molehill.ESD.3Com.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!bridge2!molehill.ESD.3Com.COM!michaelm
References: <16428@darkstar.ucsc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!bridge2!molehill.ESD.3Com.COM!michaelm
From: michaelm@ESD.3Com.COM (Michael McNeil)
Newsgroups: comp.os.msdos.programmer
Subject: Re: "finding" text in files
Message-ID: <michaelm.676003716@molehill.ESD.3Com.COM>
Date: 4 Jun 91 02:48:36 GMT
References: <16428@darkstar.ucsc.edu>
Sender: news@bridge2.ESD.3Com.COM
Lines: 48
Nntp-Posting-Host: molehill.esd.3com.com