I'm trying write a script that will download a tarball from github and extract a single file from it.
However the top level directory inside the tarball has some random characters in it, which I think change when the repo/tarball is updated, making it difficult to reliably specify the path to the file I want to extract.
wget https://github.com/paulp/sbt-extras/tarball/master tar --strip-components=1 -xf 'paulp-sbt-extras-d6c7222.tar.gz' 'paulp-sbt-extras-d6c7222/sbt'
But I want something like this:
wget https://github.com/paulp/sbt-extras/tarball/master -O sbt-extras.tar.gz tar --strip-components=1 -xf 'sbt-extras.tar.gz' '[generic tld placeholder]/sbt'
Basically I want to replace all randomly-generated characters with something generic, so I don't have to edit the script anytime the random characters change.
I thought about writing the tar output to standard out and then piping into something that could grab just the sbt file and discard the rest, but not sure what tool to use for that:
wget https://github.com/paulp/sbt-extras/tarball/master -O sbt-extras.tar.gz tar --strip-components=1 -xf 'sbt-extras.tar.gz' -O - | [grab the sbt file, write it, and discard everything else]