Operating System - HP-UX
1838388 Members
3585 Online
110125 Solutions
New Discussion

shell script to replace a char by another

 
SOLVED
Go to solution
Mister_Z
Frequent Advisor

shell script to replace a char by another

I would like to obtain an script that processes an input file and replaces a determined char by another one.

Thanks in advance!
I work for HP
4 REPLIES 4
Pete Randall
Outstanding Contributor
Solution

Re: shell script to replace a char by another

I think you need to look at sed. For example:
sed 's/foo/bar/'


Pete

Pete
Umapathy S
Honored Contributor

Re: shell script to replace a char by another

sed 's/CHAR/REPLACECHAR/g'

This is too generic a question. You can come with more specific questions and some examples.

HTH,
Umapathy
Arise Awake and Stop NOT till the goal is Reached!
Mister_Z
Frequent Advisor

Re: shell script to replace a char by another

It works!
I work for HP
RAC_1
Honored Contributor

Re: shell script to replace a char by another

Replace a char, difficult for me.
Not good at scripts/awk.

Check man tr
There is no substitute to HARDWORK