I need to replace the following characters: with a with a with i with s with tThe replacement must be case sensitive. For example if a letter is upper-case then it must be replaced with an upper-case letter. I've read that I could use sed for this process but I don't know how to use it. Can anyone help me by writing the exact command that I must run in Terminal?
How can I replace a character in all the .php files inside a folder on OS X?
text processing;sed;replace
Even though sed is commonly used for these types of tasks, it isn't actually designed for themits very name is stream editor.The tool that is designed for non-interactive file editing is ex.  (vi is the visual editor form of ex.)  Particularly when you want to edit files in place, ex is a far superior tool to sed.In this case the commands used are almost identical to the sed command given earlier, but they don't have to be.  The following is POSIX compliant (unlike sed -i).for file in *.php; do ex -sc '%s/[]/a/ge | %s//s/ge | %s//t/ge | %s//i/ge | x' $file ; doneExplanation:-s starts silent mode in preparation for batch processing.  -c specifies the command(s) to be executed.% means to apply the following command to every line in the file.  The s/// commands are fairly self-explanatory; the e flag at the end means that any errors (due to the pattern not being found) are suppressed and file processing will continue.| is a command separator (not a pipe).x tells ex to write any changes to the file (but only if there were changes) and exit.If you want in-place file editing, ex is the tool of choice.  If you want to preview the changes before you make them, I'd recommend using tr as @gardenhead suggests.(Of course, if you're using a proper version control system such as git, you could make the changes in place using ex and compare the files to the old version by running git diff.)