我正在使用diff命令来比较两个Wordpress目录(一个最近被漏洞攻击,另一个是普通拷贝)。在我的差异命令的迷雾中,我有很多不同,但很少“仅在”
例如:
Files public_html/wp-includes/widgets.php and public_html 2/wp-includes/widgets.php differ
Files public_html/wp-includes/wp-db.php and public_html 2/wp-includes/wp-db.php differ
Files public_html/wp-includes/wp-diff.php and public_html 2/wp-includes/wp-diff.php differ
Files public_html/wp-login.php and public_html 2/wp-login.php differ
Only in public_html 2/: wp-options.php
Files public_html/wp-signup.php and public_html 2/wp-signup.php differ
我关心'Only in'输出。解决这个问题的最佳方式是什么?
答案 0 :(得分:2)
将输出传递给类似grep的命令以对其进行过滤。给定目录a /和b /:
diff -qr a/ b/ | fgrep 'Only in'
或者,如果您希望跳过区分大小写,可以尝试:
diff -qr a/ b/ | fgrep -i 'Only in'