I have the URL (see below) of a certain web page that lists many different versions of a software package.
The following one-liner gets me the latest version tar ball and its signature file out of the HTML.
wget -qO- http://ftp.gnu.org/gnu/wget/ | grep tar | cut -d\" -f6 | tail -n4 | grep gz
Probably not the shortest most efficient one liner, but hey, I'm learning and I'm open for feedback. The result of the above is this:
Now, the next logical step (to me at least), is to pipe the output above into
sed and append the
$URL to the front of each line so that the output looks
And then I want to pipe that right back into
wget to download the files.
The question is this: How do I append the value of the bash variable
the front of each line of output using
sed? I tried the following:
But that only gives me the error:
sed: -e expression #1, char 11: unknown option to `s'
I also know that the basic concept is good, because when I use the following, I get good results...
VAR="Gorauskas, " echo "Jonas" | sed "s/^/$VAR/"
So, my guess is that I need to somehow escape all of the
/ character in the
$URL variable... Am I on the right track?