Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!i2unix!inria!seti!minos!deschamp From: deschamp@minos.inria.fr (Philippe Deschamp) Newsgroups: comp.unix.shell Subject: Re: How to strip A NEWLINE Message-ID: <1781@seti.inria.fr> Date: 30 Nov 90 17:25:01 GMT References: <25665@uflorida.cis.ufl.EDU> Sender: news@seti.inria.fr Reply-To: deschamp@seti.inria.fr Organization: INRIA Lines: 35 In article <25665@uflorida.cis.ufl.EDU>, bjs@reef.cis.ufl.edu (Brian J. Smith) writes: |> I have searched high and low for the answer on how to strip a NEWLINE |> charactor from a file. Well not really a NEWLINE char, but a ":\\\n" |> (colon,back-slash,newline). I have tried useing sed with: |> |> sed 's/:\\\n//' file |> |> and using the RS variable in awk, but to no avail. sed will remove |> the colon and the back-slash, but not the newline. The key is that "\n Matches a NEWLINE embedded in the pattern space." (from sed(1)). So you must embed a NL in the pattern space! With the "N" command, for example. The following does what you asked for, I should think: sed -e ': more /:\\$/{ N s/:\\\n *:*/:/ t more }' You can read this as while the current line ends with ":\", do append next line to current, with NL in between, get rid of "\", the NL and some TABs and superfluous ":"s end while Have fun! Sed is a wonderful tool, as long as you don't overuse it... Philippe Deschamp. Tlx: 697033F Fax: +33 (1) 39-63-53-30 Tel: +33 (1) 39-63-58-58 Email: Philippe.Deschamp@nuri.inria.fr || ...!inria!deschamp Smail: INRIA, Rocquencourt, BP 105, 78153 Le Chesnay Cedex, France