removing end of line mark with sed
Chris Bertin
chrisb at risky.Convergent.COM
Sat Aug 25 04:43:45 AEST 1990
In article <1990Aug19.234327.19785 at iwarp.intel.com>, merlyn at iwarp.intel.com (Randal Schwartz) writes:
> In article <1990Aug19.194911.16628 at fs-1.iastate.edu>, spam at 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 at risky.Convergent.COM
Unisys | or
(408) 435-3762 | ...!uunet!pyramid!ctnews!risky!chrisb
More information about the Comp.unix.questions
mailing list