Shell Scripting - URL manipulation

view full story

http://stackoverflow.com – I need to manipulate a URL from the values from a file. This is what I could do var=$(grep -A2 -i "some_text" /path/to/file | grep -v "some_text" | cut -d'"' -f 4-5 | cut -d'"' -f 1 | tr -d '\n') This will give output : /text/to/be/appended/to/domain Now, I need to append the domain name to var value. So I did, var1="http://mydomain" and then echo ${var1}${var} So I expect http://mydomain/text/to/be/appended/to/domain to be the output. But am getting just /text/to/be/appended/to/domain. I guessed it'd be due to the / as the first char, but if i use cut to remove the first /, am (HowTos)