Print a portion of a line

Hi,
I am facing a little problem...
I have a line like this :
asdcvashfasashXXXXxxxzxcadd:sdcashjqdasdsmgdkdaxdsnd;
I want to print just a portion of line i.e starting from left 5 characters from ":" and upto ";" i.e. in this case it would be
"xcadd:sdcashjqdasdsmgdkdaxdsnd;"
The length of right most string can vary but end with ";".
Also what to do if I want to print just 5 character left to ";"

Thanks in advance.

echo "$mylineoftext" | awk '{ print substr($0, index($0, ":") ) }'  # question 1
echo "$mylineoftext" | awk '{ print substr($0, length($0) -5 ) }'  # question #2

Use shell parameter expansion; there's no need to waste time and CPU cycles with external commands.

line="asdcvashfasashXXXXxxxzxcadd:sdcashjqdasdsmgdkdaxdsnd;"
temp=${line%?????:*}
printf "%s\n" "${line#"$temp"}"
line="asdcvashfasashXXXXxxxzxcadd:sdcashjqdasdsmgdkdaxdsnd;"
temp=${line%??????*}
temp=${line#"$temp"}
printf "%s\n" "${temp%;}"