Path: utzoo!censor!becker!geac!jtsv16!uunet!samsung!think!snorkelwacker!bloom-beacon!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.unix.questions Subject: Re: tr Keywords: tr ascii Message-ID: <1989Nov21.040338.10316@athena.mit.edu> Date: 21 Nov 89 04:03:38 GMT References: <579@ncelvax.UUCP> <15949@bloom-beacon.MIT.EDU> <1004@greens.UUCP> Sender: news@athena.mit.edu (News system) Reply-To: jik@athena.mit.edu (Jonathan I. Kamens) Distribution: usa Organization: Massachusetts Institute of Technology Lines: 27 In article <1004@greens.UUCP> matthew@greens.UUCP (Matthew Stier - Sun Visualization Products) writes: >In article <15949@bloom-beacon.MIT.EDU> jik@athena.mit.edu (Jonathan I. >Kamens) writes: >} >} No, the 'tr' command is not capable of changing a single character >}in the input to multiple characters of output. > >True, but this particular problems can be handled by AWK also. > >awk '{printf ("%s\r\n", $0)}' $* This will work, yes. However, the original poster asked if tr can substitute multiple characters in the output for one character in the input, and than gave the LF -> CR + LF case as an *example* of where that would be necessary. Awk will work for that one case, but it doesn't address the general problem. The perl script already posted (by Randal Schwartz, I think?) is the best solution I've yet seen to the general problem. Oh, well, off to learn perl.... :-) Jonathan Kamens USnail: MIT Project Athena 11 Ashford Terrace jik@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8495 Home: 617-782-0710