Issue
I have a file with content like
12345
I need to convert this kind of strings like this:
"0"->"a"
"1"->"b"
...
"9"->"j"
So, 12345
should result in abcde
. I want to achieve this via the shell (bash). What is the best way to do this?
Solution
In any shell, you could use:
echo "$string" | tr 0123456789 abcdefghij
Or, in Bash and without a pipe:
tr 0123456789 abcdefghij <<< "$string"
(where the double quotes might not be necessary, but I'd use them to be sure).
Answered By - Jonathan Leffler Answer Checked By - Marilyn (WPSolving Volunteer)