Skip to content

Instantly share code, notes, and snippets.

@nikhilsuvarna
Created October 11, 2017 23:49
Show Gist options
  • Save nikhilsuvarna/6829d5bac44fae5baf45e74e040112b8 to your computer and use it in GitHub Desktop.
Save nikhilsuvarna/6829d5bac44fae5baf45e74e040112b8 to your computer and use it in GitHub Desktop.
extract a file from multiple tar bundles that have the same file name
for i in `ls -1 logs`
do
# for j in `$i | awk -F "." '{print $1"."$2}'`
# do
tar --strip-components=2 -xvf logs/$i consul_agent/consul_agent.stdout.log
mv consul_agent.stdout.log consul_agent_`echo $i | awk -F "." '{print $1"."$2}'`
#echo $i |awk -F "." '{print $1"."$2}'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment