\HH to match characters by their hexadecimal representation (H = 0 … 9, A … F). \x41 is the representation of A, a 1 gets replaced by A, a 2 by B etc. sed 's/1/\x41/;
s/2/\x42/;
s/3/\x43/;
s/4/\x44/;
s/5/\x45/;
s/6/\x46/;
s/7/\x47/;
s/8/\x48/;
s/9/\x49/' testfiles/word-pairs