How to modify a content of particular line in a file using Shell scripting, when the text in that line is repeated many time in other lines as well. For example in the file i have :
##############################
[CC-COARSEGRID-PRECONDITIONER]
##############################
# Relaxation parameter
domega = 1.0
##############
[CC-PRECONDMK]
##############
# Relaxation parameter
domega = 0.9
I want to change the last line to: domega = 0.4
sed -i -e '$s/=.*$/= 0.4/' file