This is the most common way of my sed usage:
echo Good morning | sed 's/\(.*\s\+\).*/\1evening/g'
Here are brief notes on that ..
The above script changes
Good morning to
Note that the following characters needed the escape character
- Brackets to create regex groups:
- Plus sign to match one or more times:
- Note that the
*characters don’t need escaping.