Capturing a number at the end of line and store it as variable

Hello, Would someone guide me on how to write a shell script the would search for a phone no using at the end text file using sed or awk and store it in a varaible or print it.

The text file is in this form

text or numbers in first line
text or numbers in second line
.
.
.
Firsname Lastname:KEN:+254456789

The first lines may take any form but the last line will always be
of the form "Firstname Lastname:KEN:+254456789"
I would like to seach for the Phone and store it in a variable and print it.
The phone no will alway be preceeded by ":+"

Thank you in advance

sample file: test
---------------------------
text or numbers in first line
text or numbers in second line
.
.
.
Firsname Lastname:KEN:+254456789
------------------------------------

> phonenum=`tail -1 test | cut -d"+" -f2`
> echo $phonenum

this can be done in a loop for number of files .

for i in `ls textfiles*`
do
phonenum=`tail -1 $i | cut -d"+" -f2`
echo $phonenum
done

Thank you mk1216.

The code worked. I one day old in regards to working with awk and sed. Would explain what tail -1 test | cut -d"+" -f2 means. Also how do I append the + back when assigning the results of tail -1 test | cut -d"+" -f2 to variable $phonenum.

Thank you again for the help you have given.

for i in `ls textfiles*`
do
phonenum=`tail -1 $i | cut -d":" -f3`
echo $phonenum
done

Try this , now $phonenum should have + as well !

Previous code holds good only if your data file's last line is always in this format :

"Firsname Lastname:KEN:+254456789"

Thanks mk1216.
Works.
Please explain how
phonenum=`tail -1 number.txt | cut -d"+" -f2`
get the number in add the plus.

Thanks Again.

Try this:

phonenum=+`tail -1 number.txt | cut -d"+" -f2`