Minor addendum: That works from a Windows command line. In *nix you need to put "*.lib" in quotes, because the wildcard expansion happens before the command is called.
Cheers
Phil Hobbs
Minor addendum: That works from a Windows command line. In *nix you need to put "*.lib" in quotes, because the wildcard expansion happens before the command is called.
Cheers
Phil Hobbs
AIUA you need the cygwin command line to use $(...) , so you're going to need quotes, unless you're someplace (cwd) where *.lib aint.
If you don't want to go full Cygwin, there's this:
I don't know who people live without grep, xargs and find. In Windows,you have to say:
set U=c:\UnixUtils\bin
%U%\find . -name "*.c" | xargs grep pattern
because the shell defaults to the infernal internal "find" thing and you can't override it nor can you delete it.
-- Les Cargill
No updates since 2003.
I use:
One down side is that I have to dig through a mess of packages and install just what I need.
Worse, some packages are incompatible with others. Fortunately, the basic commands (usually) work well.
Ummmm....
SUBST U: C:\UNIXUTILS\BIN SET PATH=C:\UNIXUTILS\BIN;%PATH% (optional) U:\find / start_dir -name "*.c" -print | xargs grep search_pattern
Huh? find is an external command not found in the sh, bash, ksh, command, or cmd shell. C:\windoze\system32\find.exe is supplied with Windoze as an external program. I agree that it sucks.
There's a unix 'find' as well. To get more or less the function of DOS/Win 'dir', you can go e.g.
'find . -ls -iname "pattern"'
Cheers
Phil Hobbs
For those that want to stay with the stock Microsoft DOS commands, you can sorta search for a file using:
start -> run -> cmd cd \start_directory dir /s/b search_criteria
This will recurse through the various directories under C:\start_directory and list anything that matches the search_criteria. Unfortunately, the DOS shell (command or cmd) does not impliment the full regex (regular expression) expansion. That means one can NOT use search criteria such as: *junk*.c or any *.c filename with the word "junk" included. The best one can do is: junk*.c which is any filename starting with the word "junk". Still, it's useful for crude searches when other utilties are not available.
I think that changed at some point--leading splats work for me.
Cheers
Phil Hobbs
Oops, you're right. I just tried it with XP and it works as you describe. It certainly wasn't like that in Windoze 95/98/ME but apparently it was fixed in XP and beyond. Of course, I never noticed until today. Thanks.
No Eunuchs here ;-) ...Jim Thompson
There are a number of versions of GREP for Win out there but none AFAICT are free. I'm thinking about springing for one but I'd rather not comparison shop when it costs real $$.
Yeah, it's finished :)
Right! I put up the URL to show another option.
That works, too.
"The shell" I referred to is c:\windoze\system32\cmd.exe
-- Les Cargill
People have pointed to three separate free ones in this thread alone.
-- Les Cargill
Plenty of free grep tools available.
?????
Shareware $30.
and probably a dozen more.
Note: For the Unix challenged out there, the Windoze "find" command is a cut down mutation of the Unix "grep" command, and has nothing to do with the Unix "find" command which searches for filenames.
I saw them after I'd posted.
Bollocks. ;)
Cheers
Phil Hobbs
Yes! Lots of those are on this newsgroup ;-) ...Jim Thompson
\*\.lib will do.
I prefer backslash quoting to '" quotes. Single and double quotes have different meanings, BTW. I can never remember which does what.
Find is extremely powerful. It will conditionally execute commands on files, and much else.
It takes longer to fathom the syntax from the man page than it would to just do the whole thing manually ;-)
OK for regular users, occasional users not so good.
Have something to add? Share your thoughts — no account required.
Ask the community — no account required