sed puzzle

Nathan Aubrey nathan at paysonlinux.org
Wed Dec 5 09:59:35 MST 2007


All,

I need to replace some words with other words, but sometimes the words are not 
present, so I need to add the words.
In a config file I use, it has the following field

KIDS     :
Mother   : Amanda
Father   : Scott


It is easy to swap out the names of mother or father, as the variables are 
there, but if I try to swap out a kids name and there is no kids name already 
in place, how do I add it instead? Is it one command, or must I test if the 
content is empty then add instead of replacing?

The field example cannot change as it's just the format I use...
I appreciate any insite, sed is a great tool, but man! what a beast!

nathan


More information about the PLUG-discuss mailing list