【发布时间】:2011-05-12 15:56:49
【问题描述】:
我想在这行上使用 sed:
--> ASD = $start ( *.cpp ) <--
其中 $start 不是变量,我想在它上面使用 sed 并将所有这一行替换为:
ASD = $dsadad ( .cpp )
如何让 sed 忽略特殊字符,我尝试在特殊字符前添加反斜杠,但可能我弄错了,谁能给我举个例子?
这就是我想要的:
sed 's/CPPS = \$(shell ls | grep \*\.cpp )/somereplace/' Makefile
【问题讨论】:
-
ls | grep *.cpp最好在 GNU Make 中写成$(wildcard *.cpp),或者如果你真的坚持使用ls(but don't),则写成ls *.cpp。