Date: Fri, 12 Mar 1999 11:14:04 -0800 From: Graeme Tait <graeme@echidna.com> To: SERVICE Jim -TS+NP DVLPMT <Jim.Service@oht.hydro.on.ca> Cc: questions@freebsd.org Subject: Re: Use of pipe with gzip | more Message-ID: <36E9677C.462B7F4@echidna.com> References: <ACFC07E2E0DAD111A55F00600894C8C752B606@KEX2.RD.Hydro.ON.CA>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?36E9677C.462B7F4>