Created
November 10, 2015 22:15
-
-
Save cuevasclemente/18ce7e103ce5788576ab to your computer and use it in GitHub Desktop.
Sum of the matching part of the last line of a set of files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First, get the last line of each file (each log file) | |
# Then, pull the floating point number at the end of the line | |
# Then, collect the sum of `1/floating_point_number`. At the end, print | |
# s | |
tail -n 1 *.log | grep -e "[0-9]\.[0-9]*$" -o | awk '{s+=1/$1} END {print s}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment