Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!rutgers!att!cbnewsk!exs From: exs@cbnewsk.att.com (eric.sweetman) Newsgroups: comp.unix.shell Subject: Re: changing a ! to a \nC where \n is a newline Summary: Replacing Newline with Another Character Keywords: vi Message-ID: <1990Sep21.183049.4584@cbnewsk.att.com> Date: 21 Sep 90 18:30:49 GMT References: <5015@alpha.cam.nist.gov> Distribution: usa Organization: AT&T Bell Laboratories Lines: 16 In article <5015@alpha.cam.nist.gov>, Sean Coleman ) writes: > I am trying to use the global substitution power in vi to > replace every occurrence of ! with a newline and a C (\nC) > ... > How about the reverse, replace a newline with a character? A shell solution to replacing a newline with another character is to use the tr command which translates a single character into another. For example, cat forbar|tr '\012' ' '>tmp replaces newlines in foobar with spaces and places output in tmp. 012 is the octal code for newline. Other uses for tr include: tr '[a-z]' '[A-Z]' translates lower to upper case tr '()' '{}' translates open(close) parentheses to open(close) braces Eric Sweetman exs@pruxm.ATT.COM