[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: inserting carriage return characters



On Sat, Jun 01, 2002 at 12:05:58AM -0700, ben wrote:
| On Friday 31 May 2002 11:01 pm, Sean 'Shaleh' Perry wrote:
| > On 01-Jun-2002 Paul E Condon wrote:
| > > What is a simple way to insert a carriage return character just before
| > > each line feed (new line) character in a text file?
| >
| > in other words, make it look like a Windows text file?  The sysutils
| > package has two utilities -- 'fromdos' which removes ^M and 'todos' which
| > adds them.
| 
| useful information. i was torn about responding, reluctant to accommodate the 
| devil's formats,

It's a good format, when the output goes to a printer :-).

    sed 's/$/\r/'

(double-check the \r expansion, otherwise insert a literal CR via ^V^M)
to be used as :

    sed 's/$/\r/' < foo.text >> /dev/printers/0

(then when you get cups configured right you don't need to do that
anymore :-))

-D 

-- 

(E)ventually (M)allocs (A)ll (C)omputer (S)torage
 
GnuPG key : http://dman.ddts.net/~dman/public_key.gpg

Attachment: pgpqXinkywebD.pgp
Description: PGP signature


Reply to: