就像标题所说的那样,
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
不确定发现了什么?
答案 0 :(得分:1)
%f File's name with any leading directories removed (only
the last element).
答案 1 :(得分:0)
使用“%h%f”获取完整路径(相对于当前路径)。
find . -iregex '.*\(html\|htm\)' -printf '%h%f\0'