Path: utzoo!attcan!uunet!mcvax!philmds!leo From: leo@philmds.UUCP (Leo de Wit) Newsgroups: comp.unix.questions Subject: Re: a "trivial" sed question Message-ID: <504@philmds.UUCP> Date: 13 Jun 88 05:09:19 GMT References: <512@cogen.UUCP> Reply-To: leo@philmds.UUCP (L.J.M. de Wit) Organization: Philips I&E DTS Eindhoven Lines: 29 In article <512@cogen.UUCP> alen@cogen.UUCP (Alen Shapiro) writes: >I know the answer is 'use tr -d "\012"' but here is the question; > >Is there a way USING SED to remove all chars from a file. This is [40 lines deleted] From an sed addict: I don't think this can be done for any size of file. I'll explain: Whenever sed outputs a line, it has a trailing newline. The best you can do is thus create one big line containing all lines of the file and remove newlines from it (all but the last). You already indicated that you can use N to add to the pattern space. The problem is: this pattern space has of course a limited size (don't know if it is malloc'ed or just a big buffer) unless sed swaps this space to the disk (don't think so). Think your core dump was due to running out of buffer space. If your file is small enough, you could do: sed -n -e ' 1h 2,$H ${ x s/\n//g p }' your_file This doesn't need labels (look Ma, no GOTO's! 8-). Leo.