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?
我正在尝试使用cscope-indexer脚本。但我想知道如何更改以下内容以包含* .mm和* .java文件?
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 个解决方案
#1
Try:
egrep -i '\.([chly](xx|pp)*|cc|hh|mm|java)$' | \
sed -e '/\/CVS\//d' -e '/\/RCS\//d' -e 's/^\.\///' | \
sort > $LIST_FILE
#2
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".
当你在原始正则表达式中看到[chly]时,这意味着“要么是'c','h','l',要么是'y'。当它改为”chly *“时,它现在意味着”chl“ “后面跟着任意数量的y。而且,当你从第一个时期前面删除'\'时,你改变了它的意思,从”匹配一个句号“到”匹配任何一个字符“。
For more information on regexes, check out the Perl Regular Expression Guide, since Perl pretty much invented regular expressions.
有关正则表达式的更多信息,请查看Perl正则表达式指南,因为Perl几乎发明了正则表达式。
#1
Try:
egrep -i '\.([chly](xx|pp)*|cc|hh|mm|java)$' | \
sed -e '/\/CVS\//d' -e '/\/RCS\//d' -e 's/^\.\///' | \
sort > $LIST_FILE
#2
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".
当你在原始正则表达式中看到[chly]时,这意味着“要么是'c','h','l',要么是'y'。当它改为”chly *“时,它现在意味着”chl“ “后面跟着任意数量的y。而且,当你从第一个时期前面删除'\'时,你改变了它的意思,从”匹配一个句号“到”匹配任何一个字符“。
For more information on regexes, check out the Perl Regular Expression Guide, since Perl pretty much invented regular expressions.
有关正则表达式的更多信息,请查看Perl正则表达式指南,因为Perl几乎发明了正则表达式。