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