Interesting little trick I came across today. I had a list of values that looked like:
Compare time: 0.109375s
Compare time: 0.015625s
Compare time: 0.03125s
Compare time: 0.015625s
Compare time: 0.03125s
Compare time: 0.015625s
I wanted to add up all the values, and didn’t have access to a Linux box (where I could just run awk in a while loop), nor do I have Python installed on here.
So, I opened up the list in notepad, replaced all the “Compare time: ” with an empty string. Then, something told me to try replacing the trailing “s” with a plus sign, and pasting it into the windows Calculator window. I tried it with just the first two:
0.109375+
0.015625
and sure enough, it worked. So I copied the entire list, and pasted it into the Calculator window, and viola! I had my answer. For once, a nice surprise in a GUI!
And just to balance out the light and dark sides, the same experiment in PowerToy Calculator gives…
0.109375+
ERROR:Unknown characters occurred []
If you append an equal sign to the last number in the list it will show the total and you avoid one mouse click :)
-HD