Replacing CR (\r) character with sed

Luciano Miguel Ferreira Rocha strange at nsk.no-ip.org
Sat Feb 24 13:26:16 UTC 2007


On Sat, Feb 24, 2007 at 02:14:12PM +0100, Alexander Kriegisch wrote:
> Sorry, Denis,
> 
> I want to do this with busybox (ash, not bash). I know it works in a
> bash, but when I try this in my busybox, I get the following:
> 
> $ uname -a
> Linux fritz.box 2.6.13.1-ohio #1 Sun Feb 18 14:18:07 CET 2007 mips unknown
> $ echo -ne 'dos\r\ntext\r\n' | hexdump -C
> 00000000  64 6f 73 0d 0a 74 65 78  74 0d 0a                 |dos..text..|
> 0000000b
> $ echo -ne 'dos\r\ntext\r\n' | sed $'s/\r//g' | hexdump -C
> 00000000  64 6f 73 0d 0a 74 65 78  74 0d 0a                 |dos..text..|
> 0000000b

$ echo -ne 'dos\r\ntext\r\n' |  sed "s/`echo -ne '\r'`//g" | hexdump -C
00000000  64 6f 73 0a 74 65 78 74  0a                       |dos.text.|
00000009

-- 
lfr
0/0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20070224/a62e5416/attachment-0002.pgp 


More information about the busybox mailing list