Sed replace specific line in file

It is straightforward. Use the s command in sed to search and replace.

sed 's/# autologin=dgod/autologin=ubuntu/' /path/to/file

If you see what you want, add -i to change the file in place

sed -i 's/# autologin=dgod/autologin=ubuntu/' /path/to/file

I've found the most effective way to do this is actually to use the change syntax to set the exact value you want unless you are explicitly trying to enable a two way toggle. You can use this to change as well as uncomment a line no matter how it is commented, with # or // or <!--.

sed 's%searchTerm=% c searchTerm=desiredValue%' targetFile.txt