It only found *.inf in the current directory, and if I remove those it further compalins that no filespec matching files exist.
Also this grep seems to not like to have stdout piped to it for it to grep upon.
U:\Distrib\Win2K\Images>grep --help | grep -i version
grep: fstat: Invalid argument
Annoying beast! I'd like to move to this one since it is open source and more current and standard, but this is a bit crazy in my opinion... need the simple stuff to work! ;-)
On Linux with the same build of grep, the piping works fine, but the recurse is also a pain there.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you want grep to recurse into a directory tree, tell it the top level directory of the tree, (or subtree) you are interested in, rather than a file name prototype.
If you want to restrict it to specific file name prototypes use:
find dir -iname 'fileproto' -exec grep regex {} \;
Can't comment on your piping problem -- I use MSYS grep, which doesn't have it.
HTH.
Keith.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well I guess I got toooo used to IBM's Employee Written / open source grep for OS/2 when it comes to recurse and fileproto as it had a shorter / direct syntax.
Anyway, I was able to get an open (*) recurse working. Now about getting a fileproto working. It looks like this grep supports the following options which makes calling find not necessary.
-r, --recursive equivalent to --directories=recurse
--include=PATTERN files that match PATTERN will be examined
--exclude=PATTERN files that match PATTERN will be skipped.
But adding --include=*.inf for example results in no matches vs it matching in inf files and non-inf files alike.
I guess I will open a bug about the piping problem.
Thanks!
Michael
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The --include option isn't supported by the MSYS grep which I use, (v2.4.2), but on my Linux box, (Mandrake 8.2, grep 2.5f),
grep -r --include='*.c' GNU groff-working
displays the lines from only *.c files, in my groff source tree. You might need to quote the fileproto on Windoze too -- you certainly do on Linux, if it contains wildcards.
If you do revert to the find command, as I suggested earlier, the -H option to grep might be useful, i.e.
find dir -iname 'fileproto' -exec grep -H regex {} \;
HTH.
Keith.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
grep (GNU grep) 2.5.1
Maybe I am missing something, I am unable to get grep to recurse a directory tree. See example...
================================
U:\Distrib\Win2K\Images>dir *.inf /b
hi.inf
ho.inf
U:\Distrib\Win2K\Images>dir FI600E*.inf /b
SYSPREP.INF
U:\Distrib\Win2K\Images>head FI600E\SYSPREP.INF
;SetupMgrTag
[Unattended]
OemSkipEula=Yes
UnattendMode=FullUnattended
DriverSigningPolicy=Ignore
U:\Distrib\Win2K\Images>grep -ir Oem *.inf
U:\Distrib\Win2K\Images>del *.inf
U:\Distrib\Win2K\Images>grep -ir Oem .inf
grep: .inf: Invalid argument
================================
It only found *.inf in the current directory, and if I remove those it further compalins that no filespec matching files exist.
Also this grep seems to not like to have stdout piped to it for it to grep upon.
U:\Distrib\Win2K\Images>grep --help | grep -i version
grep: fstat: Invalid argument
Annoying beast! I'd like to move to this one since it is open source and more current and standard, but this is a bit crazy in my opinion... need the simple stuff to work! ;-)
On Linux with the same build of grep, the piping works fine, but the recurse is also a pain there.
grep -r regex dir
If you want grep to recurse into a directory tree, tell it the top level directory of the tree, (or subtree) you are interested in, rather than a file name prototype.
If you want to restrict it to specific file name prototypes use:
find dir -iname 'fileproto' -exec grep regex {} \;
Can't comment on your piping problem -- I use MSYS grep, which doesn't have it.
HTH.
Keith.
Well I guess I got toooo used to IBM's Employee Written / open source grep for OS/2 when it comes to recurse and fileproto as it had a shorter / direct syntax.
Anyway, I was able to get an open (*) recurse working. Now about getting a fileproto working. It looks like this grep supports the following options which makes calling find not necessary.
-r, --recursive equivalent to --directories=recurse
--include=PATTERN files that match PATTERN will be examined
--exclude=PATTERN files that match PATTERN will be skipped.
But adding --include=*.inf for example results in no matches vs it matching in inf files and non-inf files alike.
I guess I will open a bug about the piping problem.
Thanks!
Michael
I found there was a newer build of grep released to fix the piping issue, I have updated to that version. That problem is now resolved.
Michael
The --include option isn't supported by the MSYS grep which I use, (v2.4.2), but on my Linux box, (Mandrake 8.2, grep 2.5f),
grep -r --include='*.c' GNU groff-working
displays the lines from only *.c files, in my groff source tree. You might need to quote the fileproto on Windoze too -- you certainly do on Linux, if it contains wildcards.
If you do revert to the find command, as I suggested earlier, the -H option to grep might be useful, i.e.
find dir -iname 'fileproto' -exec grep -H regex {} \;
HTH.
Keith.
Quotes did it, and on Win32 they need to be double and not single. Single send grep off into CPU eating lala land. So, a working syntax to share...
grep -ir --include="*.inf" oem .
Case insensitive, recurse, where filespec is *.inf looking for oem and start looking in the current directory.
Thanks!
Michael