Dear developers,
Need your help with the following:
I want to use the sed command to change a password in a configuration file of nodogsplash.conf
I use this command which work fine.
sed -i 's,Password test4321,Password test1234,' /etc/nodogsplash/nodogsplash.conf
but the problem is that command look for a match of the whole string 'Password test4321' and replace it by 'Password test1234', but what i need is sed command to replace only the string that is actually the password,
I have tested other sed commands without success.
the problem seems that nodogsplash.conf have several line that start with "Password"
seems that the sed command need to check for a blank space after Password.
but i have no idea how to do that.
I tested the bellow without success.
sed -i 's/^Password .*$/Password test1234/' /etc/nodogsplash/test.txt
sed -i 's/^Password .*$/Password test1234/' /etc/nodogsplash/nodogsplash.conf
sed -e 's/^\( *Password *\)[^ ]*\(.*\)*$/\1PacMan\2/' /etc/nodogsplash/nodogsplash.conf
sed -e '/^ *Password / s/ [^# ]/ PacMan45/' /etc/nodogsplash/nodogsplash.conf
thanks for any help.
(Last edited by luisgcu on 15 Nov 2016, 03:05)