home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / next / misc / 19045 < prev    next >
Encoding:
Text File  |  1992-08-27  |  2.0 KB  |  54 lines

  1. Newsgroups: comp.sys.next.misc
  2. Path: sparky!uunet!cs.utexas.edu!torn!maccs!nextasy!tlm
  3. From: tlm@nextasy.physics.mcmaster.ca (Tom Marchioro)
  4. Subject: Re: UNIX -> DOS conversion; ToolsInspector
  5. Message-ID: <1992Aug28.014229.27872@maccs.dcss.mcmaster.ca>
  6. Sender: news@maccs.dcss.mcmaster.ca (News account)
  7. Organization: McMaster University, Hamilton, Ontario, Canada.
  8. References: <1992Aug25.144013.1@evax12.eng.fsu.edu>
  9. Date: Fri, 28 Aug 1992 01:42:29 GMT
  10. Lines: 42
  11.  
  12. schmidmeier@evax12.eng.fsu.edu writes:
  13. : Hello UNIX-Experts,
  14. : now that I've learned frome some post a few days ago how to
  15. : search files and replace certain strings using
  16. :       cat oldfile | sed s/oldstring/newstring/g > newfile
  17. : I'm wondering whether I can convert a UNIX-file to a
  18. : DOS-file that way, by replacing all the LineFeeds with
  19. : CarriageReturn and LineFeed (\015 and \012 I think).
  20. : Using \012 as a string did not work, so what will I have to do ?
  21.  
  22. One way to do it is wiht 
  23.  
  24. sed -e 's/$/^M/'  file   >newfile
  25.  
  26. where th ^M is a "literal character" which you get by typing the combination
  27. of characters "literal-next control-M".  To see what character gives you
  28. "literal next" type "stty all" and you get
  29.  
  30. new tty, speed 38400 baud, 24 rows, 80 columns; -tabs 
  31. crt 
  32. decctlq 
  33. erase  kill   werase rprnt  flush  lnext  susp   intr   quit   stop   eof
  34. ^?     ^U     ^W     ^R     ^O     ^V     ^Z/^Y  ^C     ^\     ^S/^Q  ^D     
  35.  
  36. notice that this says that ^V (control-V) makes the next character "literal."
  37.  
  38. The only thing is, in my experience this WILL NOT work with the NeXT csh
  39. because (I believe) of a bug (i.e. the literal next character seems not to be
  40. bound properly).  It DOES work using tcsh (which is what I use) and thus
  41. I use the sed command all the time.  I've tried (under csh) using \015
  42. instead of ^M but it still doesn't work. 
  43.  
  44. My advice:  switch to tcsh (or some other nicer shell --- PLEASE, let's
  45. not get that thread going again about which is the best shell :-) and then
  46. use the sed command.
  47.  
  48. Hope this is Helpful --- Tom
  49.  
  50.  
  51.