tags:

views:

94

answers:

2

Hi,

I am trying to use the cscope-indexer script. But I want to know how to change the following to include *.mm and *.java files?

egrep -i '\.([chly](xx|pp)*|cc|hh)$' | \
sed -e '/\/CVS\//d' -e '/\/RCS\//d' -e 's/^\.\///' | \
sort > $LIST_FILE

I tried

egrep -i '\.([chly](xx|pp)*|cc|hh|mm|java)$'

it does not work.

+2  A: 

Try:

egrep -i '\.([chly](xx|pp)*|cc|hh|mm|java)$' | \
sed -e '/\/CVS\//d' -e '/\/RCS\//d' -e 's/^\.\///' | \
sort > $LIST_FILE
bdonlan
I have tried adding 'mm|java' to egrep. It does not work. I get cscope no source files found.
yinglcs
Perhaps cscope can't parse java or '.mm' files?
bdonlan
A: 

When you saw [chly] in the original regex, that meant "either a 'c', an 'h', an 'l', or a 'y'. When changed it to "chly*", it now meant "chl" followed by any number of y's. Also, when you removed the '\' from in front of the first period, you changed it's meaning from "match a period" to "match one of any character".

For more information on regexes, check out the Perl Regular Expression Guide, since Perl pretty much invented regular expressions.

John Gibb
No, Perl definitely did not invent regular expressions. The guide is nice, though.
Svante
No +1 for the patently false statement "Perl pretty much invented regular expressions".
ephemient