On Fri, 7 Feb 2025, Bruno Ribeiro via Freedos-devel wrote:

Hi Steve,

On 7/2/2025 10:51, Steve Nickolas via Freedos-devel wrote:
On Fri, 7 Feb 2025, Bruno Ribeiro via Freedos-devel wrote:

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.

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.

Unfortunately, it seems FreeDOS does not support it as well:

C:\FREEDOS>find/?
FreeDOS Find, version 3.0
GNU GPLv2 - copyright 1994-2007 by Jim Hall, Eric Auer and Imre Leber
FIND: Prints all lines of a file that contain a string
FIND [ /C ] [ /I ] [ /N ] [ /V ] "string" [ file... ]
 /C  Only count the matching lines
 /I  Ignore case
 /N  Show line numbers
 /V  Print lines that do not contain the string

C:\FREEDOS>

That makes sense. It's on keel with MS-DOS 6.22, which is FreeDOS' intention.

I did write my own FIND, but it doesn't support /S either. Using some GNUey version of grep or fgrep is probably your best bet.

-uso.


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

Reply via email to