🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.misc
Article #2255

Re: UNIX -> DOS conversion; ToolsInspector

#2255
From: Tom Marchioro
Date: Fri, 28 Aug 1992 01:42
40 lines
2085 bytes
schmidmeier@evax12.eng.fsu.edu writes:
: 
: Hello UNIX-Experts,
: 
: now that I've learned frome some post a few days ago how to
: search files and replace certain strings using
:       cat oldfile | sed s/oldstring/newstring/g > newfile
: I'm wondering whether I can convert a UNIX-file to a
: DOS-file that way, by replacing all the LineFeeds with
: CarriageReturn and LineFeed (\015 and \012 I think).
: Using \012 as a string did not work, so what will I have to do ?
: 

One way to do it is wiht 

sed -e 's/$/^M/'  file   >newfile

where th ^M is a "literal character" which you get by typing the combination
of characters "literal-next control-M".  To see what character gives you
"literal next" type "stty all" and you get

new tty, speed 38400 baud, 24 rows, 80 columns; -tabs 
crt 
decctlq 
erase  kill   werase rprnt  flush  lnext  susp   intr   quit   stop   eof
^?     ^U     ^W     ^R     ^O     ^V     ^Z/^Y  ^C     ^\     ^S/^Q  ^D     

notice that this says that ^V (control-V) makes the next character "literal."

The only thing is, in my experience this WILL NOT work with the NeXT csh
because (I believe) of a bug (i.e. the literal next character seems not to be
bound properly).  It DOES work using tcsh (which is what I use) and thus
I use the sed command all the time.  I've tried (under csh) using \015
instead of ^M but it still doesn't work. 

My advice:  switch to tcsh (or some other nicer shell --- PLEASE, let's
not get that thread going again about which is the best shell :-) and then
use the sed command.

Hope this is Helpful --- Tom
Technical Details
Message-ID: <1992Aug28.014229.27872@maccs.dcss.mcmaster.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!torn!maccs!nextasy!tlm
References: <1992Aug25.144013.1@evax12.eng.fsu.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.misc
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!torn!maccs!nextasy!tlm
From: tlm@nextasy.physics.mcmaster.ca (Tom Marchioro)
Subject: Re: UNIX -> DOS conversion; ToolsInspector
Message-ID: <1992Aug28.014229.27872@maccs.dcss.mcmaster.ca>
Sender: news@maccs.dcss.mcmaster.ca (News account)
Organization: McMaster University, Hamilton, Ontario, Canada.
References: <1992Aug25.144013.1@evax12.eng.fsu.edu>
Date: Fri, 28 Aug 1992 01:42:29 GMT
Lines: 42