What's the DOS equivalent of the Unix find-grep combo for searching
recursively within a directory all files matching a given criteria for
strings within them matching a given expression?

Put in other words, more simply, how do I find within \freedos hierarchy
which text files have the string "foobar" occurring in them?

Looking for a DOS-centric way of doing that.  As last resort I know I
can always install DJGPP's find and grep.

That would actually be a good way to do it, if you ask me :-)

You could rename one of the FIND to keep DOS and GNU distinguishable.

On PC DOS 7, there's find /s, but I don't think any other version of DOS (including DR DOS or Win9x) supports that and I have no idea about FreeDOS.

A freeware method to do this might be using LOCATE:

C:\>locate /?

LOCATE.COM   v1.26a   04-17-1999   C. Dye   raster highfiber.com
Freeware.  Copyright 1995-1999, Charles Dye.  No warranty!

Syntax:  LOCATE [filespec] [switches]
  /H   Hidden or system       /D-  find files, not Directories
  /X   .COM, .EXE, .BAT       /D+  find Directories only
  /Fn  only First n items     /D   find both (default)
  /A   check Attributes       /T   path search
  /0   0-byte files           /R   local hard drives only
  /G   Go to directory        /K   Kill (delete) items
  /N   bare Naked display     /W   Wide display
  /S   Summary info only      /P   Peter-style display
  /L   Win95 Long filenames   /NP  No Paging

  /B:"command" Batch output   /D:[start][,end]  Date range
  /O:"string"  macro Output   /T:[start][,end]  Time range
  /C:"string"  run Commands   /S:[small][,big]  Size range

Space between the filespec and any switches.  Output will be paged
unless it is redirected or /NP used.  Specify default switches in a
LOCATE= variable.  Try /D? /T? /S? /A? /B? or /O? for more help.

However, it will probably be slow to use /B or C to invoke a fresh
instance of DOS FIND or GNU GREP for each file found by LOCATE?

So there will be better methods, looking forward to hear about them!

Regards, Eric




_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to