Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!voder!pyramid!ctnews!risky!chrisb From: chrisb@risky.Convergent.COM (Chris Bertin) Newsgroups: comp.unix.questions Subject: Re: removing end of line mark with sed Message-ID: <602@risky.Convergent.COM> Date: 24 Aug 90 18:43:45 GMT References: <1990Aug19.194911.16628@fs-1.iastate.edu> <1990Aug19.234327.19785@iwarp.intel.com> Organization: Convergent Technologies, San Jose, CA Lines: 25 In article <1990Aug19.234327.19785@iwarp.intel.com>, merlyn@iwarp.intel.com (Randal Schwartz) writes: > In article <1990Aug19.194911.16628@fs-1.iastate.edu>, spam@hobbes (Begley Michael L) writes: > | Here's a simple one... > | How do I remove the end of line marker from a stream? for example, > > I horsed around with the 'N' command in sed, thinking I could make it > do that, and figured out that I had lost the sed touch. (Somebody > will most certainly post the proper way to do it.) Try > > /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ Here is an ugly way to do it with sed: (cat $1; echo '\n_E_o_F_\n') | \ sed -e ':top' -e '1,/_E_o_F_/ N' -e 's/\n/ /' -e 't top' -e 's/ _E_o_F_//' Note that: sed -e ':top' -e '1,$ N' -e 's/\n/ /' -e 't top' doesn't work because sed won't print lines that are not terminated by a carriage return (bug?). If sed allowed addresses like '$-1', it would make life simpler as well. -- Chris Bertin | chrisb@risky.Convergent.COM Unisys | or (408) 435-3762 | ...!uunet!pyramid!ctnews!risky!chrisb