On Mon, Feb 19, 2001 at 11:23:28AM -0800, Peter Jay Salzman wrote:
> given
> doc.txt.gz
> doc.ps.gz
>
> how do i read these file in line? i've tried:
>
> gzip -d -c doc.txt.gz | vi
> gzip -d -c doc.ps.gz | gv
>
> but neither vim nor gv like getting data from stdin. vim complains about no
> controlling tty and gv just displays nothing.
vi <(zcat doc.txt.gz)
gv <(zcat.ps.gz)
bash (assumed) will turn <() into a fifo, thus the vi in essence becomes:
mkfifo /tmp/fifo.$$
zcat doc.txt.gz > /tmp/fifo.$$ &
vi $/tmp/fifo.$$
rm /tmp/fifo.$$
Some program's don't like fifos, but for read only things is should work
most of the time. You can't rewind a fifo of course, something that
ghostscript (and gv) sometimes likes to do.
PS... extra credit
ever want to do tee's into a pipeline of given stream?
cat file |
tee >(sort -n -k1 > file.sort.1) |
tee >(sort -n -k2 > file.sort.2) |
tee >(perl parse.pl > file.parse.1) |
{ echo total lines; wc -l ; } # yes, trailing ; required
This is very helpful when "file" is a 1gig gzipped file...
hope that helps. ;)
--
Ted Deppner
http://www.psyber.com/~ted/