我在Makefile中有以下代码片段,除非我删除下面对sed和grep的引用,否则它总是失败。
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
什么可能出了问题?
sed -ne '/^\s*$$/!{s/^\s*//;s/\s*$$//;p;}'
初始模式保留了仅包含空格和空行的内容,以免被修改或显示。(当然,我已经将 $ 值加倍了,以便于 make 的使用。) - William