Parallel and xargs commands

1. Decypher gpg files

find ./ -name “*.gpg” |  while read OUT; do echo ${OUT%.*}; done | /usr/local/bin/parallel -P 15 gpg –output {}  –decrypt {}.gpg

2. Unzip files

find ./ -name “*.gz” |  /usr/local/bin/parallel -P 15 gunzip {} \;

unzip into different directory:

find ./ -name “*.gz” | while read OUT; do echo ${OUT%.*}; done |  /usr/local/bin/parallel -P 15 “gunzip -c {}.gz > /different/directory/{/}” \;

3. Copy files with scp

cat $1 | sed -e “s:\($REMOTE_DIR\)\(.*\):scp username\@hostname.ru\:$REMOTE_DIR/\2 $LOCAL_DIR/\2:” | /usr/local/bin/parallel -P 20 /bin/bash -c “{}”

4. Move files from find output

find /db/Db_1/oradata/data_rdb -name “*.gz” | while read OUT; do echo ${OUT%.*}; done | xargs -I {} mv {}.gz {}