I want to replace a-l letters with m-z letters and m-z characters with a-l in text file using tr command. (a is replaced with m, b with n, c with o, m with a, b with n, etc.) I tried `tr a-l m-z | tr m-z a-l but it replaces a-l letters with m-z letters first and then all characters are replaced with a-l.
Asked
Active
Viewed 1,831 times
1 Answers
2
Try
tr '[a-z]' '[m-za-l]'
Ex.
$ echo 'the quick brown fox jumped over the lazy dog' | tr '[a-z]' '[m-za-l]'
ftq cguow ndaiz raj vgybqp ahqd ftq xmlk pas
steeldriver
- 131,985
- 21
- 239
- 326