Re: Replace 0d with a space

"Sven Guckes [email protected] [sed-users]" <[email protected]> Thu, 21 Jul 2016 18:02:45 +0200
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
* Kathryn Jennings  [email protected] [2016-07-21 17:45]:
> I have been trying to remove all 0d characters within a document
> with a space.  I can delete the 0d using    tr -d '\n' I cannot find
> anything that will help me replace it.  I am thinking that sed is
> the correct command to use, but am unsure how to code the 0d character.

you might be looking for this (taken from sed1line.txt):

 # IN UNIX ENVIRONMENT: convert Unix newlines (LF) to DOS format.
 sed "s/$/`echo -e \\\r`/"            # command line under ksh
 sed 's/$'"/`echo \\\r`/"             # command line under bash
 sed "s/$/`echo \\\r`/"               # command line under zsh
 sed 's/$/\r/'                        # gsed 3.02.80 or higher

i wonder:  why choose sed?
is this just a one-time job?
does it have to be automated?
does it have to be really fast?

for example, converting a single file i'd use the editor vim:

    $ vim file
    :%j
    :x

these commands could be automated/scripted, of course.
but there are many tools out there which can do this.

Sven

-- 
Sven Guckes       sig-sed @guckes.net         GNU SED: 4.2.2   [2012-12-22]
SED Download:   ftp://ftp.gnu.org/gnu/sed/    SED FAQ: http://go.to/sed-faq
SED One-Liners: http://sed.sf.net/sed1line.txt SEDSED: http://sedsed.sf.net
SED   HomePage: http://www.gnu.org/directory/sed.html