From owner-freebsd-questions Fri Mar 12 8:17:16 1999 Delivered-To: freebsd-questions@freebsd.org Received: from hecate.webcom.com (hecate.webcom.com [209.1.28.39]) by hub.freebsd.org (Postfix) with ESMTP id 38FF214C45 for ; Fri, 12 Mar 1999 08:17:11 -0800 (PST) (envelope-from graeme@echidna.com) Received: from eresh.webcom.com (eresh.webcom.com [209.1.28.49]) by hecate.webcom.com (8.9.1/8.9.1) with SMTP id JAA04032; Fri, 12 Mar 1999 09:16:52 -0800 Received: from [204.143.69.37] by inanna.webcom.com (WebCom SMTP 1.2.1) with SMTP id 26918440; Fri Mar 12 08:13 PST 1999 Message-Id: <36E9677C.462B7F4@echidna.com> Date: Fri, 12 Mar 1999 11:14:04 -0800 From: Graeme Tait Organization: Echidna X-Mailer: Mozilla 4.5 [en] (Win98; U) X-Accept-Language: en Mime-Version: 1.0 To: SERVICE Jim -TS+NP DVLPMT Cc: questions@freebsd.org Subject: Re: Use of pipe with gzip | more References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG SERVICE Jim -TS+NP DVLPMT wrote: > > Why not use grep? > > % gzip -cd file.gz | grep 'your text string' > > More has to make a temporary file the same size as the > unzipped file whereas grep just scans a sliding window > "buffer" of the unzipped file. Because I want to page through the file, examining different lines according to different criteria. In fact sometimes I do pre-select data with $ gzip -cd file.gz | grep 'your text string' | more and such like. But why the immense inefficiency of the piped command, vs. the same commands issued separately? I've noticed this in other contexts also. BTW, I see no evidence of a temporary file using df, but in any event, there is plenty of space with a 6MB zipped file. > > I was examining a large gzipped text file (about 6MB zipped) using > > > > $ gzip -cd file.gz | more > > > > and used "/[text]" to attempt to find a line that didn't > > exist. As indicated by > > top, "more" consumed all available CPU for a very long time, > > its PRI value > > rising to over 100 before it finally reported "Pattern not > > found". The elapsed > > time was a couple of orders of magnitude more than if I had > > unzipped the file > > first, and then run "more" on the unzipped file. However, > > some files I do this > > on are so large that unzipping first places a burden on > > available file space. > > > > Is this a legitimate use of a pipe? > > > > The pipe is fine. More is the problem. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message