$ echo "<Sed is very hard to learn>" | sed -e 's/ /-/g' <Sed-is-very-hard-to-learn> $
The -e option means 'execute the following command'.
The s means Substitute.
Then you get that which you want to replace.
The next one is that what will be in place.
The g means Global, otherwise only one replace will take place, and now the whole sentence will be searched and replaced.
David H wrote:
I am trying use sed to replace some text in <, > for example:
He said: <Sed is very hard to learn>. She said: <I agree>.
I would like to replace all spaces within <, > to be a
dash.
Like this He said: <Sed-is-very-hard-to-learn>. She said: <I-agree>.
-- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list