目的
- 題記の通り、gzip 圧縮したテキストファイルに追記したいけど、「解凍→追記→圧縮」が面倒
環境
centos-release
$ cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core)
gzip
$ gzip --version
gzip 1.5
Copyright (C) 2007, 2010, 2011 Free Software Foundation, Inc.
Copyright (C) 1993 Jean-loup Gailly.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
Written by Jean-loup Gailly.
やってみる
$ echo "January" |gzip -c >> month.gz
$ echo "February" | gzip -c >> month.gz
$ zcat month.gz
出力結果
January
February
OK!