用于查找和替换的SSH命令

时间:2018-05-15 23:00:11

标签: ssh command

我想更改所有配置文件中的用户名和密码

命令在SSH中找到什么

$txpcfg['user'] = 'EXAMPLE-1';

并将其在我的服务器上更改为:

$txpcfg['user'] = 'EXAMPLE-2';

1 个答案:

答案 0 :(得分:0)

sed可与-i标志一起使用,以进行内联替换。

类似的东西:

find /path/to/workingDir -name *.config -type f -print0 | xargs -0 sed -i 's/\$txpcfg\[\'user\'\]\ = \'$oldUser\';/\$txpcfg\[\'user\'\]\ \=\ \'$newUser\';/g'

可以清理正则表达式/搜索模式。

相关问题