Operating System - HP-UX
1833934 Members
1674 Online
110063 Solutions
New Discussion

Re: Replace non-US characters in a wrapped (streamed) file

 
SOLVED
Go to solution
Kellogg Unix Team
Trusted Contributor

Replace non-US characters in a wrapped (streamed) file

Hello,

I am looking for a command/script to replace some non-US characters with US ascii character set in a "streamed" file (wc -l steamed_file gives 0 lines). I was thinking of using sed but found that sed works on "complete input lines" and in my case, my file has no complete line.

I would prefer to use hex values of these non-US characters because then I won't have to escape them in my script. Some of these characters (I have about 60 of them) are -
À (0xC0) replace with A
à (0xE0) replace with a
Û (0xDB) replace with U
á (0xE1) replace with a

I also need the resultant file to be streamed.

Would really appreciate if I can use existing unix commands to achieve this.

Thanks in advance
...Manje
work is fun ! (my manager is standing behind me!!)
3 REPLIES 3
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Replace non-US characters in a wrapped (streamed) file

cat infile | tr "[\300\340\333\341]" "[AaUa]" > outfile
If it ain't broke, I can fix that.
Kellogg Unix Team
Trusted Contributor

Re: Replace non-US characters in a wrapped (streamed) file

Wow, no wonder you are an olympian!!

Thanks a lot!
...Manjeet
work is fun ! (my manager is standing behind me!!)
Kellogg Unix Team
Trusted Contributor

Re: Replace non-US characters in a wrapped (streamed) file

Closing
work is fun ! (my manager is standing behind me!!)