Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there any tool to replace some characters with another one but at once , i mean for example i have text file like this :


Replace each of this character with another character, eg: . = H , > = E Is there any tool available so give it all characters in array and replace with another array of characters , i know ( wish ) i could do this with programming but wondering if there is any tool or technique within certain word processing software that can handle this kind of tricks ,

Thanks in advance

share|improve this question
I'm curious about the "all at once" part - do all of the substitutions have to be made at once because you have things like A = B and B = C? – Darth Android Jun 12 '12 at 14:08
What OS are you using? – Paul Jun 12 '12 at 14:14
@Darth Android no all characters are unique , A = B , C = D , * = A and so on – echolab Jun 12 '12 at 14:31
@Paul Linux Suse & Windows 7 Ultimate – echolab Jun 12 '12 at 14:32

2 Answers 2

up vote 7 down vote accepted

This is precisely the purpose of the program "tr". Naturally, you have to be using an OS that supports it (Linux, Cygwin, etc.)

cat myfile | tr 'ABCDEFGHIJ' '1234567890'
share|improve this answer
does this really do the trick i have openSuse , does this replace A = 1 , B = 2 , .... – echolab Jun 12 '12 at 14:42

With sed available on Linux / Unix / MacOSX and some RegExp magic, you can quickly do any kind of text substitutions, e.g.:

sed -r "s:\.:H:g;s:>:E:g" < INPUT_FILE
share|improve this answer
Or sed 'y/.>/HE/'. – grawity Jun 12 '12 at 14:33
could u describe this code , i mean what will get replaced with what so i can figure it out , am i able to write this script as long as full alphabetic replacement !? – echolab Jun 12 '12 at 14:36
For sed 'y/.>/HE/', the code is in the form sed 'y/{CHAR SET TO BE REPLACED}/{REPLACEMENT CHAR SET}/' That means for A=>1, B=>2, C=>3, the code needed is sed 'y/ABC/123/'. – Ron Lau Jun 13 '12 at 4:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.