I'm quite new in the linux world.I've got a file containing Usernames and Passwords, for browser authentications.eg.:user:ioeuwz5rf (Password generated with openssl passwd ABCXYZ)Now, I want these passwords to get changed automatically every week or whatever.I tried it with a change.sh file containing:newpw=`openssl passwd ABCXYZ`sed -i 's/WhatToReplace/'$newpw'/g' test.txtThis would replace the word WhatToReplace with the generated pw.But I want to do it automatically. Is there a way to replace the 2nd part  (user:ioeuwz5rf) with the random password.I want a new random password generated for every user, and this should be saved into a file (newpw.txt eg.) from which I can generate mails.
Replace parts of files
scripting;password;replace
Instead of replacing all lines in newpw.txt,it would be better to create a new file by iterating over the usernames in the old one, for example:cut -d: -f1 pw.txt | while read -r user; do    echo $user:$(openssl passwd ABCXYZ)done > newpw.txtmv newpw.txt pw.txt