Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sed Xargs是否返回到同一个文件中?_Sed_Xargs - Fatal编程技术网

Sed Xargs是否返回到同一个文件中?

Sed Xargs是否返回到同一个文件中?,sed,xargs,Sed,Xargs,假设我用find点击foo.html,我想通过管道将内容返回到foo.html find . -iregex '.*\(html\|htm\)' -printf '%P\0' | \ xargs -0 sed -Ee "s:(http|https)\://(www.|)${domain}[?/]::g" \ > # to what? {\} ??? 现在它不知道它的将-i标志传递给sed,然后它将修改输入文件 find . -iregex '.*html?' -printf '%P\0'

假设我用
find
点击foo.html,我想通过管道将内容返回到foo.html

find . -iregex '.*\(html\|htm\)' -printf '%P\0' | \
xargs -0 sed -Ee "s:(http|https)\://(www.|)${domain}[?/]::g" \
> # to what? {\} ???

现在它不知道它的

-i
标志传递给
sed
,然后它将修改输入文件

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

为什么
*html?
,顺便说一句,你说得对,我忘在原地了,全脑放屁;)加1并等待接受。简化regexp-它应该匹配以
htm
结尾的任何内容,可选地后跟
l
-i
需要一个关于BSD(即OSX)的参数,必须显式传递
'
,才能不保留备份。