Below command is used to replace the password in a script but the perl command is adding a white space when it does the subsstitution
password=arche20
perl -i -p -e "s/^(password[]*=[ ]*).*$/\1 $passwd/" config.properties
cat config.properties
userid=ARCHE
password= arche20
It does the work but it seems to be adding a space after password when it replaces.
Could this be done without the space?
Got a sed
way:
sed -i "s/password.*/password=$passwd/g"
[ ]
? All you need isperl -i -pe "s/^(password *= *).*/\1$passwd/"
. Are the empty character classes supposed to be doing something?