Is it possible to compress (create a compressed archive) data while reading from stdin on Linux?
相关问题
- Is shmid returned by shmget() unique across proces
- how to get running process information in java?
- iOS (objective-c) compression_decode_buffer() retu
- Error building gcc 4.8.3 from source: libstdc++.so
- Why should we check WIFEXITED after wait in order
Yes, use gzip for this. The best way is to read data as input and redirect the compressed to output file i.e.
cat test.csv
will send the data as stdout and using pipe-sign gzip will read that data as stdin. Make sure to redirect the gzip output to some file as compressed data will not be written to the terminal.gzip > stdin.gz
perhaps? Otherwise, you need to flesh out your question.Yes,
gzip
will let you do this. If you simply rungzip > foo.gz
, it will compress STDIN to the file foo.gz. You can also pipe data into it, likesome_command | gzip > foo.gz
.