I want to replace multiple string patterns with a different set of predefined strings.
For example:
Input:
This sentence will be converted to something different. This sentence can contain same words.
Output:
These words need to be replaced with something different. These words can contain same alphabets.
So here I want to convert in below pattern.
- This =>These
- sentence =>word
- will =>need to
- converted=>replaced
- to => with
- words => alphabets
Let me know if it can be done.
sed 's/This/These/g' input_file
orsed 's/This/These/g' <<< input_string
respectively? – dessert Nov 13 '17 at 19:31sed
. It’s fairly simple, aside from the issue of cascading substitution (you want to avoid replacing “sentences” with “alphabets”). What have you tried? – G-Man Says 'Reinstate Monica' Nov 13 '17 at 19:31