I have the URL (see below) of a certain web page that lists many differentversions of a software package.URL=http://ftp.gnu.org/gnu/wget/The following one-liner gets me the latest version tar ball and its signaturefile out of the HTML.wget -qO- http://ftp.gnu.org/gnu/wget/ | grep tar | cut -d\ -f6 | tail -n4 | grep gzProbably not the shortest most efficient one liner, but hey, I'm learning andI'm open for feedback. The result of the above is this:wget-1.15.tar.gzwget-1.15.tar.gz.sigNow, the next logical step (to me at least), is to pipe the output above intosed and append the $URL to the front of each line so that the output lookslike:http://ftp.gnu.org/gnu/wget/wget-1.15.tar.gzhttp://ftp.gnu.org/gnu/wget/wget-1.15.tar.gz.sigAnd 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 $URL tothe front of each line of output using sed? I tried the following:sed s/^/$URL/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, Iget 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?
Using sed to add a URL to the start of every line
bash;sed;wget
Use a different separator that doesn't contain any of the characters in the variable.For example,sed s|^|$URL|(If you use / as the separator and the pattern or replacement also contain /, then you'd need to escape those.)