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

Re: Stupid Question: Striping Dos ^M From Texts



In message <[🔎] 9706051135.AA00852@Priss.com>, writes:
  >
  >Somewhere in the dank recesses of my mind, I recall
  >a utility that would strip the extra ^M's from a
  >text file copied to a unix box. Well, it seems that
  >Linux also considers these ^M's extranious, is there
  >such a standard utility or do I have to dig even 
  >deeper to remember sed/awk/grep commands?  :^>
 
In vi:
:/g/^V^M$/s///
(where ^V means control-V)

or, again in vi:
:1,$s/.$//
or, in ed or sed:
1,$s/.$//
if you are sure that _every_ line ends with an unwanted character.

It seems simpler than installing a special utility.

I expect perl or awk would also offer entertaining solutions!

If you copy from a mounted msdos filesystem, or ftp in ascii mode, you
avoid the problem in the first place.
-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                      http://homepages.enterprise.net/olly

In case of connection troubles, try olly@enterprise.net instead.



--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: