In regard to: Re: TODO for 1.2 release, Moses P. Milazzo said (at 4:28pm on...:

>> Better:
>> find . -name '*.c' -o -name '*.h' -exec egrep '//' {} /dev/null \; | \
>>      grep -v '://'
>> (to get rid of false matches on URLs)
>Why not:
>grep "//" `find . -name "*.[ch]"` | grep -v 'p://'
>(the -o option doesn't seem to work as advertised in the man page)

Depends on the man page you read, and the platform you're on.

>Don't forget that ":" is used between the filename and matching line, and
>if your line begins with //, grep -v '://' chucks that valid match.

This is degenerating from the original thread, but you're right that
my grep -v '://' might throw away too much.

I avoid the backticks that you used because in general that could result
in a "line too long" problem, on many UNIXes.  My method is slower by a
lot because it will exec egrep for every file in the list, but it will
never fail because of too many files.   Probably not an issue in this case,
so yours might be better here but it might fail for a larger tree on
some platforms.

In any case Kevin's find/grep did what was needed -- find the files that
have C++ style comments in them.

Tim Mooney                              [EMAIL PROTECTED]
Information Technology Services         (701) 231-1076 (Voice)
Room 242-J1, IACC Building              (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164

Reply via email to