Re: replacing high order ascii chars using sed
From: Stephane CHAZELAS (stephane_chazelas@yahoo.fr)
Date: 04/15/03
- Previous message: Steve Mading: "Re: order of execution of process in script"
- In reply to: Josh Buedel: "replacing high order ascii chars using sed"
- Next in thread: Charles Demas: "Re: replacing high order ascii chars using sed"
- Reply: Charles Demas: "Re: replacing high order ascii chars using sed"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: Stephane CHAZELAS <stephane_chazelas@yahoo.fr> Date: 15 Apr 2003 09:44:01 GMT
Josh Buedel wrote:
> I'm trying to write a sed script that will replace certain control
> characters and high order ascii chars with a printable character. I'm using
> cygwin on a win2000 machine, from the windows command (cmd.exe) line.
>
> I have a couple of questions:
>
> 1. This command line
> sed "s/[[:cntrl:]]/X/g" b2.bin
> and this command line
> sed "s/[\x00-\x19\x7F]/X/g" b2.bin
> do not produce the same results. Why is this?
>
> 2. The byte size of the output was 12 bytes bigger than b2.bin's original
> size of 851, for both expressions. Why is this? I'm replacing a single
> character with a single character (I think).
It seems to me that MS Windows has two types of file: binary and
text, sed is a text utility, I don't know how it handles binary
files, it may do some conversions (on NL or CR chars). I don't
know wether CR is in cntrl on Windows or not.
>
> 3. What would the correct regular expression/command line be? I want to
> replace all characters 0x7F and up with an 'X'.
Use "tr" instead of sed (but pay attention to CR and NL chars).
-- Stéphane
- Previous message: Steve Mading: "Re: order of execution of process in script"
- In reply to: Josh Buedel: "replacing high order ascii chars using sed"
- Next in thread: Charles Demas: "Re: replacing high order ascii chars using sed"
- Reply: Charles Demas: "Re: replacing high order ascii chars using sed"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|
|