我的命令是:
[root@my /]# grep -lr --include=*version.php "$wp_version"/home/draka/www/
/home/draka/www/wp-content/version.php
/home/draka/www/wp-content/themes/version.php
/home/draka/www/wp-includes/version.php
我使用 sed 来查找特定的行:
[root@my /]# grep -lr --include=*version.php "$wp_version" /home/draka/www/ | xargs sed -n '7p'
$wp_version = '3.5';
每个文件夹的文件版本都不同:
- /home/draka/www/wp-content/version.php = $wp_version = '3.5.1';
- /home/draka/www/wp-content/themes/version.php = $wp_version = '3.5';
- /home/draka/www/wp-includes/version.php = $wp_version = '1.5';
我的问题是,我如何结合这 2 个输出?我想要的输出可能类似于:
/home/draka/www/wp-content/version.php = $wp_version = '3.5.1';
或者
/home/draka/www/wp-content/version.php -> $wp_version = '3.5.1';
非常感谢您的及时回复。谢谢你。