I need to get the value as follows to access the directory:
"/aaa/bbb"
I know that I need to eliminate "http://machine1:8080" and this value is read from a config file. So the length is not fixed and the value is not fixed.
I have been thinking of using grep or cut but I fail to get what I need.
I have modified it .Earlier it will be expecting the port to a 4 digit number. I have changed it now to have 1-4 digits.
echo $x |sed 's/\(.*\):[0-9]\{1,4\}\(.*\)/\2/'
sed 's/\(.*\):[0-9]\{1,4\}\(.\)/\2/' - identifying pattern upto the ip address
sed 's/\(.*\):[0-9]\{1,4\}\(.\)/\2/' - looking for a pattern of digits of size 1 to 4
sed 's/\(.*\):[0-9]\{1,4\}\(.\)/\2/' - looking for the pattern after the port number(here, directory)
sed 's/\(.*\):[0-9]\{1,4\}\(.\)/\2/' - display the second group of pattern.ie,
cfajohnson, unfortunately the decision is not mine. I have to stick with whatever shell script that was previously developed. We have used a lot of Bourne shell.
Both of the following codes work perfectly. Thanks a million.