Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need a tool that can open a text file and replace characters in a list with other characters in a list.

For example:

Lets say I have a list of "aA", "aB", and want to replace "aA" with "AA".

What is a software program that could do this easily?

share|improve this question
Virtually any scripting language can handle this easily: AutoIt, Python, Perl, etc. –  MaQleod Aug 21 '11 at 19:02
I tried this with python but the logic has not been working properly so now I need a tool. –  nobody Aug 21 '11 at 19:06
Try notepad++, you can do batch string replacement over many files: makeuseof.com/tag/…, or you can post your Python code and have a mod move this over to StackOverflow.com and they will help you out there. –  MaQleod Aug 21 '11 at 19:07

2 Answers 2

This is exactly what the sed program was made for.

share|improve this answer
well, if he means change lowercase chars to uppercase, then perhaps not so easy with sed. if he means just changing some specifics, like aA to AA, then yes. –  barlop Aug 21 '11 at 19:25
Or ex. Or indeed tr if using sed to change case is seen as hard (which, with GNU sed at least, it really isn't). –  JdeBP Aug 24 '11 at 0:00

As a Perl one-liner, to replicate sed functionality...

perl -pe " s/aA/AA/g; s/aB/AB/g; " < input.txt > output.txt

This will turn this input.txt...

aA, aA, aA, aA, aA
aB, aB, aB, aB, aB

into this output.txt...


It does this through regular expression substitution...

share|improve this answer

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.