Stripping Carriage Return / Line Feed from text file

Jay R. Ashworth jra at baylink.com
Tue Aug 26 08:35:13 PDT 2008


On Wed, Jul 30, 2008 at 05:01:18PM -0400, Jean-Pierre A. Radley wrote:
> 	#!/bin/sh
> 	#@(#)cr+-   JPRadley v 1.1
> 	#@(#)adds CRs if not present, strips them if present
> 	#@(#)if you just cat this file, you miss its essence, so instead
> 	#@(#)cat -v this file, so as to see two actual ^M that it contains
> 	sed '
> 	s-^M--g
> 	t
> 	s+$+^M+
> 	t
> 	'

I wandered into this late, but let me applaude the conceit of using -
and + characters as the sed separators; that's quite amusing.

Cheers,
-- jra
-- 
Jay R. Ashworth                   Baylink                      jra at baylink.com
Designer                     The Things I Think                       RFC 2100
Ashworth & Associates     http://baylink.pitas.com                     '87 e24
St Petersburg FL USA      http://photo.imageinc.us             +1 727 647 1274

	     Those who cast the vote decide nothing.
	     Those who count the vote decide everything.
	       -- (Josef Stalin)


More information about the Filepro-list mailing list