home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / unix / shell / 5246 < prev    next >
Encoding:
Text File  |  1993-01-05  |  1.4 KB  |  44 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!nwnexus!Celestial.COM!ray
  3. From: ray@Celestial.COM (Ray Jones)
  4. Subject: Re: stripping cr/lf's
  5. Organization: Celestial Software, Mercer Island, WA
  6. Date: Mon, 04 Jan 1993 23:54:09 GMT
  7. Message-ID: <1993Jan04.235409.8078@Celestial.COM>
  8. References: <1992Dec31.071312.6153@netcom.com> <fXuiJ5p@quack.sac.ca.us>
  9. Lines: 33
  10.  
  11. In <fXuiJ5p@quack.sac.ca.us> dfox@quack.sac.ca.us (David Fox) writes:
  12.  
  13. >In article <1992Dec31.071312.6153@netcom.com> kasajian@netcom.com (Kenneth Kasajian) writes:
  14. >>
  15. >>How do I strip the cr's from a text file?  There must be a standard
  16. >>unix way of doing it!
  17.  
  18. >There is.  One typically needs to do this when migrating DOS text files (where
  19. >each line ends in a CR and NL (ascii 13/10) to Unix (where each line ends with
  20. >just NL (ascii 10)).
  21.  
  22. >Use the tr command.
  23.  
  24. >% tr -d '\015' <in.txt >out.txt
  25.  
  26. >The '\015' may look strange: tr - and other unix commands - think in OCTAL.
  27. >Octal 015 = 12 decimal.
  28. >--
  29. >David Fox
  30. >dfox@quack.sac.ca.us
  31.  
  32. One of the nice things about UNIX is there is always more than one way to do
  33. something.  I have a shell script "dos2unix" for handeling this conversion;
  34. The script is a one liner:
  35.     cat $* | sed -e 's///g'
  36.  
  37.  
  38.  
  39. -- 
  40. INTERNET:  ray@Celestial.COM   Ray A. Jones; Celestial Software
  41. UUCP:   ...!thebes!camco!ray   6641 East Mercer Way
  42.              uunet!camco!ray   Mercer Island, WA 98040; (206) 947-5591
  43. The probability of one or more spelling errors in this missive approaches
  44.