What about something like:
$ cat file
KIDS :
Mother : Amanda
Father : Scott
$ cat file | sed 's/:.*/: bob/g'
KIDS : bob
Mother : bob
Father : bob
Not sure what you are trying to do, but the point is that using .* is
probably what you want (it matches even if there is nothing in the field).
-Charles
Nathan Aubrey wrote:
> 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!
>
>
>
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss