home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.shell
- Path: sparky!uunet!nwnexus!Celestial.COM!ray
- From: ray@Celestial.COM (Ray Jones)
- Subject: Re: stripping cr/lf's
- Organization: Celestial Software, Mercer Island, WA
- Date: Mon, 04 Jan 1993 23:54:09 GMT
- Message-ID: <1993Jan04.235409.8078@Celestial.COM>
- References: <1992Dec31.071312.6153@netcom.com> <fXuiJ5p@quack.sac.ca.us>
- Lines: 33
-
- In <fXuiJ5p@quack.sac.ca.us> dfox@quack.sac.ca.us (David Fox) writes:
-
- >In article <1992Dec31.071312.6153@netcom.com> kasajian@netcom.com (Kenneth Kasajian) writes:
- >>
- >>How do I strip the cr's from a text file? There must be a standard
- >>unix way of doing it!
-
- >There is. One typically needs to do this when migrating DOS text files (where
- >each line ends in a CR and NL (ascii 13/10) to Unix (where each line ends with
- >just NL (ascii 10)).
-
- >Use the tr command.
-
- >% tr -d '\015' <in.txt >out.txt
-
- >The '\015' may look strange: tr - and other unix commands - think in OCTAL.
- >Octal 015 = 12 decimal.
- >--
- >David Fox
- >dfox@quack.sac.ca.us
-
- One of the nice things about UNIX is there is always more than one way to do
- something. I have a shell script "dos2unix" for handeling this conversion;
- The script is a one liner:
- cat $* | sed -e 's///g'
-
-
-
- --
- INTERNET: ray@Celestial.COM Ray A. Jones; Celestial Software
- UUCP: ...!thebes!camco!ray 6641 East Mercer Way
- uunet!camco!ray Mercer Island, WA 98040; (206) 947-5591
- The probability of one or more spelling errors in this missive approaches
-