I need to reverse all string in text with 5 chars consecutive characters. For instance:
hello hi adams sde
abcde abs
Required output:
olleh hi smada sde
edcba abs
I used:
sed -n 's\(a-z]\)\([a-z]\)\([a-z]\)\([a-z]\)\([a-z]\)/\5\4\3\2\1/p'
It reverses needed strings except “adams”. Please help me fix this.
Looks like it’s not so much that “adams” isn’t replaced, but that your command is only replacing the first matching instance. Try this:
From the manual: