I need the sed syntax that searches for a pattern, but only changes those patterns that don't have a space after the = sign... for instance; this is file1.cgf:
Code:
#today= (this can be any day of the week)
#examples of today are Monday, Tuesday, etc
today=Monday
Now, I need to be able to change whatever day that comes after the uncommented "today=" at the end of the file to Saturday, but ignore the first "today= (this can be...blah)" since it has a space after the = sign.
I have got this so far to ignore the space, but it ignores the "today=Monday" as well.
Code:
sed -i 's/today=![\s ]/today=Saturday/' file1.cfg
...and if I do this:
Code:
sed -i 's/today=[\s ]*/today=Saturday/' file1.cfg
I get this:
Code:
#today=Saturday(this can be any day of the week)
#examples of today are Monday, Tuesday, etc
today=SaturdayMonday
and I need it to be:
Code:
#today= (this can be any day of the week)
#examples of today are Monday, Tuesday, etc
today=Saturday
Keep in mind that it might not always be the last instance that I need replaced and there might be multiple "today=Monday" in the file... I just need to change anything that doesn't have a space after the = sign.
Thanks.