Alternative to "rev"?

Because I want to edit entries in host-files in a way where I “change everything before the last but one dot” and I could not find an easy way to realize this with awk, grep or sed I thought of reversing the strings in every line and then simply “change everything after the second dot” and reverse it again.

Works quite good but unfortunately I had to realize that “rev” is not part of IPFire. So does anyone know a “simple” way of doing this with the tools implemented in IPFire?

Greetings Alex

Bash can do this for you:

Manipulating Strings

4 Likes