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