0

正如标题所说,

domain='foo.com'

find . -iregex '.*\(html\|htm\)' -printf '%f\0' | \
xargs -0 sed -Ee "s:(http|https)\://(www.|)${domain}::g" 

# sed: can't read index.html: No such file or directory

我期待

directory/directory/index.html

不确定 find 发生了什么?

4

2 回答 2

1

手册页说:

%f     File's name with any leading  directories  removed  (only
       the last element).
于 2013-11-14T00:19:05.633 回答
0

使用“%h%f”获取完整路径(相对于当前路径)。

find . -iregex '.*\(html\|htm\)' -printf '%h%f\0'
于 2013-11-14T00:36:25.480 回答