This is the source string:
%5B++The+transmission+is+%5B150mhz%5D+The+year+is+%282017%29+This+is+%2A+great+%2A+so+far++%5D
- Is it possible to make a pattern only with GNU SED to:
- Replace a singe + to a single space
- From
%**abc
to"\x**"abc
(the first two characters after the % is always hex UTF-8) - Every sentence must have one " at the beginning and one " at end of the sentence
So the result to be like this:
"\x5B" "The" "transmission" "is" "\x5B"150mhz"\x5D" "The" "year" "is" "\x28"2017"\x29" "This" "is" "\x2A" "great" "\x2A" "so" "far" "\x5D"
So when echo is used with the string:
echo -e "\x5B" "The" "transmission" "is" "\x5B"150mhz"\x5D" "The" "year" "is" "\x28"2017"\x29" "This" "is" "\x2A" "great" "\x2A" "so" "far" "\x5D"
Will result exactly like this:
[ The transmission is [150mhz] The year is (2017) This is * great * so far ]
(2017)
from your input string since it has%28
(or0x28 left parenthesis
) on both sides – steeldriver Nov 25 '17 at 04:17