ablog

不器用で落着きのない技術者のメモ

xargs -P を使って並列で圧縮・ファイル転送する

xargs -P を使って並列で圧縮・ファイル転送する

# 10000 行のファイルを作成する
perl -le 'printf(qq/%05d\n/, $_) for 1..10000' > total
# 1000 行ごとにファイルを分割する
split --numeric-suffixes=1 -l 1000 total splited_
# 8 並列で圧縮する
find . -type f -name 'splited_*' -print0|xargs -0 -I{} -P8 gzip 
# 8 並列でファイル転送する
find . -type f -name 'splited_*.gz  -print0|xargs -0 -I{} -P8 aws s3 cp {} s3://awssampledb/test/