6
我在Makefile中有下面的代码片断,它总是失败,除非我删除下面的sed & grep的引用。如何在makefile shell命令中使用管道?
TAB=$(shell printf "\t")
all: abstract.tsv
$(shell cut -d "${TAB}" -f 3 abstract.tsv | sed "s/^\s*//" | \
sed "s/\s*$//" | grep -v "^\s*$" | sort -f -S 300M | \
uniq > referenced_images.sorted.tsv)
这是错误我得到:
/bin/bash: -c: line 0: unexpected EOF while looking for matching `"'
/bin/bash: -c: line 1: syntax error: unexpected end of file
出了什么问题?
可能是一个副本http://stackoverflow.com/questions/2382764/escaping-in-makefile – 2013-02-25 16:24:17
只是FYI,sed和grep之一的两个调用可以组合成一个sed实例:sed -ne '/^\ s * $$ /!{s/^ \ s * //; s/\ s * $$ //; p;}''初始模式只保留空格,空行不被修改或显示。 (当然,我为了赚钱而把$加倍了。) – William 2013-02-25 19:27:52