Skip to content

Instantly share code, notes, and snippets.

@oldpatricka
Created March 19, 2010 17:40
Show Gist options
  • Save oldpatricka/337921 to your computer and use it in GitHub Desktop.
Save oldpatricka/337921 to your computer and use it in GitHub Desktop.
#!/bin/bash
# usage: flattar.sh tarfile.tar
#
# doesn't gunzip files. You'll need to do that yourself first
tarfile=$1
shift
tar -tvf $tarfile | grep -v "^d" | awk {'print $6'} | while read filename
do
tar "$@" -O -xf $tarfile $filename >${filename##*/}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment