Re: Can I put a ^M on a command line somehow?
From: Robert Bonomi (bonomi_at_host122.r-bonomi.com)
Date: 08/28/04
- Next message: Chris F.A. Johnson: "Re: Can I put a ^M on a command line somehow?"
- Previous message: Robert Bonomi: "Re: question in using cat/more in shell script"
- In reply to: Paul Bullack: "Re: Can I put a ^M on a command line somehow?"
- Next in thread: Chris F.A. Johnson: "Re: Can I put a ^M on a command line somehow?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 28 Aug 2004 10:57:21 +0000
In article <cgpgeu$t6m$03$1@news.t-online.com>,
Paul Bullack <paul.bullack@t-online.de> wrote:
>Hello Alan
>
>try sed 's/^V^M$//' < infile.c > outfile.c
Note: that is only 3 characters between the 1st pair of slashes.
[CTL-V], [CTL-M], and [$]
>
>Paul
>
>
>
>"Alan Mackenzie" <acm@muc.de> schrieb im Newsbeitrag
>news:7bepgc.36.ln@acm.acm...
>> Korn shell and Bash shell.
>>
>> I want to write a little sed command which will remove 0x0d from the end
>> of each line in a file. Yes, I know there are any number of ways of
>> performing this all too commonly necessary task. But...
>>
>> I've tried
>> sed 's/\r$//' < infile.c > outfile.c
>>
>> I've tried
>> sed 's/\015$//' < infile.c > outfile.c
Note: the above might work *if* you escape the '\' as '\\', giving sed a
chance to interpret the control character symbolism internally.
>> I've tried typing
>> sed 's/\
>> followed by <ctrl>-m, which prints a new line on the terminal with the
>> secondary prompt, then finishing up with
>> $//' < infile.c > outfile.c
>>
>> When I tried this on ksh, and brought the command back to the screen with
>> the command history, I found it had decided that by "^M" I really meant
>> "^J". :-(
ayup. standard 'tty' driver behavior. to map the 'return' key into the unix
[NL] character.
- Next message: Chris F.A. Johnson: "Re: Can I put a ^M on a command line somehow?"
- Previous message: Robert Bonomi: "Re: question in using cat/more in shell script"
- In reply to: Paul Bullack: "Re: Can I put a ^M on a command line somehow?"
- Next in thread: Chris F.A. Johnson: "Re: Can I put a ^M on a command line somehow?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|