Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!elroy.jpl.nasa.gov!sdd.hp.com!think.com!ames!haven.umd.edu!umbc3.umbc.edu!math16.math.umbc.edu!rouben From: rouben@math16.math.umbc.edu (Rouben Rostamian) Newsgroups: comp.unix.shell Subject: Re: sed to remove newlines? Keywords: sed Message-ID: <1991May30.005548.19506@umbc3.umbc.edu> Date: 30 May 91 00:55:48 GMT References: <6356@iron6.UUCP> Sender: newspost@umbc3.umbc.edu (News posting account) Distribution: comp.unix.shell Organization: University of Maryland Baltimore County, Mathmatics Department Lines: 17 In article <6356@iron6.UUCP> yeates@motcid.UUCP (Tony J Yeates) writes: |Is it possible to remove newlines (i.e. \n) from a file using sed? If |so how? |... |[Our current requirement is to concatenate any lines ending with a ':' to the |next line in a file. Although I can think of numerous other uses ( we |usually end up using tr '\012' '' as a work around).] To concatenate lines ending in a ':' to the following line using sed, do: sed '/:$/{N; s/\n//; }' outfile -- Rouben Rostamian Telephone: (301) 455-2458 Department of Mathematics and Statistics e-mail: University of Maryland Baltimore County bitnet: rostamian@umbc.bitnet Baltimore, MD 21228, U.S.A. internet: rouben@math9.math.umbc.edu