Você pode fornecer um exemplo de uso para 'zrun'?

0

Eu estava lendo as páginas de manual para o pacote moreutils, mas não entendi a página para zrun .

Minha página de manual é quase a mesma que a die.net :

ZRUN(1)                                                                ZRUN(1)



NAME
       zrun - automatically uncompress arguments to command

SYNOPSIS
       zrun command file.gz [...]

DESCRIPTION
       Prefixing a shell command with "zrun" causes any compressed files that
       are arguments of the command to be transparently uncompressed to temp
       files (not pipes) and the uncompressed files fed to the command.

       This is a quick way to run a command that does not itself support
       compressed files, without manually uncompressing the files.

       The following compression types are supported: gz bz2 Z xz lzma lzo

       If zrun is linked to some name beginning with z, like zprog, and the
       link is executed, this is equivalent to executing "zrun prog".

BUGS
       Modifications to the uncompressed temporary file are not fed back into
       the input file, so using this as a quick way to make an editor support
       compressed files won't work.

AUTHOR
       Copyright 2006 by Chung-chieh Shan <[email protected]>



moreutils                         2010-04-28                           ZRUN(1)

Você pode fornecer um exemplo de uso?

    
por uprego 19.02.2014 / 13:53

1 resposta

3

Aqui está um exemplo;

$ cat >afile
This is a file
line2
line3
$ cp afile bfile
$ gzip afile
$ ls -l
total 8
-rw-r--r-- 1 usera usera 48 2014-02-19 13:24 afile.gz
-rw-r--r-- 1 usera usera 27 2014-02-19 13:24 bfile

com grep

$ grep line *
bfile:line2
bfile:line3

com zrun

$ zrun grep line *
/tmp/dpQH01hY51-afile:line2
/tmp/dpQH01hY51-afile:line3
bfile:line2
bfile:line3

Você pode ver que grep não vê as linhas apropriadas no afile.gz do zipado. No entanto, quando usar zrun ,

zrun primeiro descompacta afile.gz em /tmp e o comando real executado por zrun é:

$ grep line /tmp/dpQH01hY51-afile bfile
    
por 19.02.2014 / 14:30