LoginSignup
2
0

More than 5 years have passed since last update.

【shell】圧縮・解凍 ほかいろいろ

Last updated at Posted at 2017-03-12

新規ディレクトリ作成

mkdir NewFolder

ディレクトリに存在しない時だけ新規ディレクトリ作成 -p

mkdir -p NewFolder

dataFileを.tar.gz圧縮する

tar zcvf dataFile.tar.gz dataFile

.tar.gzを解凍する

tar -zxvf dataFile.tar.gz

.tar.gzを解凍先ディレクトリ指定で解凍する -C

mkdir -p NewFolder
tar -zxvf dataFile.tar.gz -C NewFolder

圧縮ファイル .tar.gzから 文字を検索する zgrep

2017-03-01.tar.gz
2017-03-02.tar.gz
の中から"004”を検索する

zgrep "004" *.tar.gz

出力結果
Binary file 2017-03-01.tar.gz matches
Binary file 2017-03-02.tar.gz matches

Binary file matches 対処方法 -a

grep -a "004" *.tar.gz

出力結果
2017-03-01.tar.gz:4,"kapibara@test.com",004,"ああああ","いいいい"

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0