Extract values from log file

I would like to write a shell script that will parse through a file similar to the sample below. The data in the file is redirected from rsync into a log file. I would like to call a shell script to parse through and pick out the number beside the percent sign inside the parentheses in the last occurrence in the file. So in the sample text below, I would like it to pick out the "0.1" in "(21, 0.1% of 38220)".

What is the best way to accomplish this? Using sed? Can I search for the last occurrence explicitly or do I need to do several pipe operations to accomplish this?

Here is a section of the file that I want to be able to parse:

Documents/Birthday Invites/Birthday Invite.psd
32768 0% 1.04MB/s 0:00:20
131072 0% 60.18kB/s 0:06:08
4521984 20% 950.50kB/s 0:00:18
8716288 39% 1.07MB/s 0:00:12
12910592 57% 1.12MB/s 0:00:08
17104896 76% 1.23MB/s 0:00:04
21299200 95% 1.13MB/s 0:00:00
22298611 100% 1.13MB/s 0:00:18 (17, 0.1% of 38220)
Documents/Birthday Invites/._Birthday Invite.psd
25190 43% 0.00kB/s 0:00:00
57958 100% 10.42MB/s 0:00:00 (18, 0.1% of 38220)
Documents/Birthday Invites/Invites1.pdf
32768 0% 27.63kB/s 0:04:35
65536 0% 55.08kB/s 0:02:17
4489216 58% 1.23MB/s 0:00:02
7659360 100% 1.91MB/s 0:00:03 (19, 0.1% of 38220)
Documents/Birthday Invites/Invites2.pdf
32768 0% 0.00kB/s 0:00:00
4489216 58% 1.90MB/s 0:00:01
7662562 100% 2.81MB/s 0:00:02 (20, 0.1% of 38220)
Documents/Birthday Invites/Invites3.pdf
32768 0% 0.00kB/s 0:00:00
4489216 58% 1.76MB/s 0:00:01
7657907 100% 2.65MB/s 0:00:02 (21, 0.1% of 38220)
Documents/Birthday Invites/Invites4.pdf
32768 0% 0.00kB/s 0:00:00
4489216 58% 1.20MB/s 0:00:02

grep '(.*)' input_file | tail -1 | sed 's/.*(.* \(.*\)%.*/\1/'

Thanks, I will give that a try.

Thank you for your help. Because there is the possibility of error messages which have parentheses in them, I needed to modify your shell script a little. But essentially, it's the same thing and it works perfectly.

egrep '([0-9]+, [0-9.]+% of [0-9]+)' input_file | tail -1 | sed 's/.*(.* \(.*\)%.*/\1/'

This way I am guaranteed only to filter out the progress percentages. I will deal with error messages separately. Could you clarify how you select out the number before the percentage sign in sed? I am assuming it has something to do with the \(.*\)%. Why do you use escaped parentheses here?

Follow is my code, but i do not know why awk can only locate to the above line of the last line, but can not locate the last line. Pls help me.

sed '/(/!d' a > c
line=`cat c | wc -l`
cat c | awk 'BEGIN{print "'"$line"'"}
{
print NR
if (NR=="'"$line"'"-1)
print $0
}' > ff
cat ff | sed 's/.*,\(.*\)%.*/\1/'

output::
5

1
2
3
4
 0.1
5

Anyone pls help me why i can only locate to the second-last line not the last line.
Any suggestion will be appreciate!

try this
parameter1=`grep "(.*)" inputfile |tail -1|cut -f6 -d" "`
parameter2=${parameter1%"%"}