Re: Change character code 160 to 32

2009-10-05 Thread Telemachus
On Sun Oct 04 2009 @ 3:28, Shawn H Corey wrote: If you're on Linux, type: man ascii Works on OSX, too. And thanks for the tip. That's handy, and I never knew it was there. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org

Change character code 160 to 32

2009-10-04 Thread Mike Flannigan
I want to change character code 160 to character code 32 throughout a bunch of text files. I'm using this right now s/(.)/ord($1) == '160' ? chr(32) : $1 /eg; and it works, but I don't like it much. If anybody has another way they like better, I'd appreciate seeing it. It does not have to be

Re: Change character code 160 to 32

2009-10-04 Thread Shawn H Corey
Mike Flannigan wrote: I want to change character code 160 to character code 32 throughout a bunch of text files. I'm using this right now s/(.)/ord($1) == '160' ? chr(32) : $1 /eg; and it works, but I don't like it much. If anybody has another way they like better, I'd appreciate seeing

Re: Change character code 160 to 32

2009-10-04 Thread Shlomi Fish
On Sunday 04 Oct 2009 17:53:24 Mike Flannigan wrote: I want to change character code 160 to character code 32 throughout a bunch of text files. I'm using this right now s/(.)/ord($1) == '160' ? chr(32) : $1 /eg; and it works, but I don't like it much. If anybody has another way they like

Re: Change character code 160 to 32

2009-10-04 Thread John W. Krahn
Mike Flannigan wrote: I want to change character code 160 to character code 32 throughout a bunch of text files. I'm using this right now s/(.)/ord($1) == '160' ? chr(32) : $1 /eg; Here you are using the decimal numbers 160 and 32. This is very inefficient as you are searching for *every*

Re: Change character code 160 to 32

2009-10-04 Thread Mike Flannigan
Shawn H Corey wrote: Use the hex notation: perl -i -ple 'tr/\xA0/\x20/' files Thank you. Much appreciated. I do like that much better. Someday I'll know hexidecimal better. Right now it's got a little magic for me. Mike -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For

Re: Change character code 160 to 32

2009-10-04 Thread Shawn H Corey
Mike Flannigan wrote: Shawn H Corey wrote: Use the hex notation: perl -i -ple 'tr/\xA0/\x20/' files Thank you. Much appreciated. I do like that much better. Someday I'll know hexidecimal better. Right now it's got a little magic for me. Mike If you're on Linux, type: man