gpt4 book ai didi

linux - 需要在文本文件中更新新密码

转载 作者:太空宇宙 更新时间:2023-11-04 06:00:57 25 4
gpt4 key购买 nike

我有大约 100 个文件,我需要根据 Linux 服务器中不同位置文件中的不同用户更新新密码。

​那么,有没有通用的shell脚本可以根据用户名从旧密码更新为新密码。

请找到下面给出的文件内容“Resource driverClassName =“com.mysql.jdbc4.jdbc.sysdert”name =“jdbc/ryr_ined”type =“sql.DataSource”url =“jdbc:mysql:xyz.com:1025/weare”username =“xyz”password =“abcd”autoCommit =“false”maxActive =“20”maxIdle =“10”maxWait =“20000””并且“资源名称=“Tkmool”用户名=“weare”密码=“abcd”maxActive=“20”maxIdle=“10”maxWait=“-1”“

感谢您对此的帮助。

最佳答案

这就是您要找的东西?

read -p "path (eg. *.conf will match a.conf)?" path
read -p "username?" username
read -p "new password?" password
find $path -exec sed -r "s/(username="${username}".*password=)\w*/\1"${password}"/g" \{} >temporaryPasswordFile.tmp \; -exec mv temporaryPasswordFile.tmp \{} \;

要求不存在名为temporaryPasswordFile.tmp 的文件。

关于linux - 需要在文本文件中更新新密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30995933/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com