Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/27.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
Linux Find | Grep | Sed在functions.php中查找我在whm中所有网站的字符串_Linux_Bash_Shell - Fatal编程技术网

Linux Find | Grep | Sed在functions.php中查找我在whm中所有网站的字符串

Linux Find | Grep | Sed在functions.php中查找我在whm中所有网站的字符串,linux,bash,shell,Linux,Bash,Shell,请帮我个大忙,我找不到执行我需要的代码 现在我们开始:我需要在我所有网站的路径中找到一个字符串,如路径: grep -iRl "wpfeed" */public_html/wp-content/themes/*/ 但是有一个问题,就是将/themes/*/复制/粘贴实际目录列表/bin/ls-Rl*/public\u html/wp content/themes/*/functions.php | head-10。使用鼠标选中文本的编辑菜单中的{}工具将其格式设置为code

请帮我个大忙,我找不到执行我需要的代码

现在我们开始:我需要在我所有网站的路径中找到一个字符串,如路径:

grep -iRl "wpfeed" */public_html/wp-content/themes/*/

但是有一个问题,就是将
/themes/*/
复制/粘贴实际目录列表
/bin/ls-Rl*/public\u html/wp content/themes/*/functions.php | head-10
。使用鼠标选中文本的编辑菜单中的
{}
工具将其格式设置为
code/data/requiredOutput/ExactErrMsgs
。不要指望读者去外部网站了解你的问题。发布图像没有帮助,因为读者无法使用其web浏览器的搜索工具查找特定文本,如果读者想要重现您的问题,他们将不得不键入一组数据,而不是从您的问题(Q)中复制/粘贴。祝你好运。我们真的无法调试你为什么不匹配
function.php
文件中的
wpfeed
。通过理解为什么它不能在一个文件中工作来简化测试。制作一个测试文件,从
function.php
复制3行,其中一行包含
wpfeed
,然后让它工作
unix2dos function.php
可能有帮助<代码>grep将始终有效,还有一些其他问题您还没有发现。一旦您发现问题,请创建一个小测试目录,从主目录复制3-5个文件。让它发挥作用。现在grep-irlwpfeedtestdir/path/to/function.php | xargs sed-S'2,4d'{}'可以工作了。通过
sed--help
确认您的
sed
支持
-S
选项。祝你好运,谢谢!我发现了问题。。。就是这套路哈哈,我的坏!你能帮我做验证吗?比如:如果有字符串-删除183处的第2行,如果没有设置,则什么也不做
grep -iRl "wpfeed" */public_html/wp-content/themes/*/functions.php.
sed '2,4d' file
root@odin.agenciaalper.com.br [home]# /bin/ls -Rl */public_html/wp-content/themes/*/functions.php | head -10
-rw-r--r-- 1 abcompensadoscom abcompensadoscom  18731 Nov 26  2018 abcompensadoscom/public_html/wp-content/themes/consulting/functions.php
-rwxr-xr-x 1 abpmcom          abpmcom           26240 Jun 27  2018 abpmcom/public_html/wp-content/themes/consulting/functions.php
-rwxr-xr-x 1 agenciaalpercom  agenciaalpercom   30337 Apr 17  2019 agenciaalpercom/public_html/wp-content/themes/thefox3/functions.php
-rwxr-xr-x 1 agenciaalpercom  agenciaalpercom   36620 Oct  2  2018 agenciaalpercom/public_html/wp-content/themes/TheFox/functions.php
-rw-r--r-- 1 agencialoncom    agencialoncom     24496 Jun  3 12:46 agencialoncom/public_html/wp-content/themes/consulting/functions.php
-rw-r--r-- 1 allcarcentercom  allcarcentercom   18731 May 13  2019 allcarcentercom/public_html/wp-content/themes/consulting/functions.php
-rw-r--r-- 1 amarekombuchacom amarekombuchacom  19670 Apr 29 14:26 amarekombuchacom/public_html/wp-content/themes/consulting/functions.php
-rw-r--r-- 1 amaropisoscom    amaropisoscom     24016 May 18  2019 amaropisoscom/public_html/wp-content/themes/consulting/functions.php
-rw-r--r-- 1 amigaopneuscom   amigaopneuscom    26159 Jul 28 12:47 amigaopneuscom/public_html/wp-content/themes/consulting/functions.php
-rw-r--r-- 1 amplitudeacustic amplitudeacustic  24436 Jun 27 14:03 amplitudeacustic/public_html/wp-content/themes/consulting/functions.php