On 7/2/2025 11:00, Eric Auer 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. > > That would actually be a good way to do it, if you ask me :-)
Practically, 100% agree! Theoretically, my problem with it is twofold: 1. GNU's not DOS ;) 2. Seriously, though, that's not viable for anyone running DOS on a 286- system. I think a 8086 FreeDOS system should be able to at least automatically and recursively search for fixed strings within all text files within a given directory. > You could rename one of the FIND to keep DOS and GNU distinguishable. Would always preserve the DOS executable name in a DOS system. I think I'd call GNU's: "gfind". > 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. Didn't know about LOCATE. Thanks for bringing it into attention! Too bad it is not part of FreeDOS, or at least FLOSS. > 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? Perhaps at least as slow as using DJGPP's find and grep. Probably less, I'd expect? > So there will be better methods, looking forward to hear about them! Sure to let you know, in case I find one. _______________________________________________ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel