These examples are for compressing/decompressing, and preserving the original file.
Gzip-ing and gunzip-ing -
cat abc.txt | gzip > abc.gz
gzip -cd zbc.gz > abc.txt (-d decompress, -c send to console)and similarly for bzip2 and bunzip2 -
cat abc.txt | bzip2 > abc.txt.bz2
Some commands that operate directly on gzip-ped files -
zcat abc | less (abc can be a text file or a gzip-ped file)
zless def (the file need not have extension .gz)
zdiff abc.gz def
zgrep "pattern" abc.gzand similarly for bzip2, we have bzcat, bzless, bzdiff and bzgrep.
No comments:
Post a Comment