I am trying to write a script which parses a log file and will eventually put the values in an array so that I can perform some math on it. In this file I am only interested in the last 200 lines so here is the command I use to display the contents in a manageable manner.
Some numbers and characters 1 = 5.09093e-03 C
Some numbers and characters 2 = 6.09030e-03 C
Some numbers and characters 3 = 4.48998e-03 C
Some numbers and characters 4 = 4.55334e-03 C
Some numbers and characters 5 = 7.38398e-02 C
I would like to store the numbers after the = sign into an array cutting off the whitespace in front and the whitespace, C and newline character at the end.
Thanks Ahamed101 it worked great. I could not use the set but I was able to use your second suggestion.
I think the greping is okay since it works, but thanks for offering to help with that.
only thing was that I had to change arr[$i]=$val to arr[i]=$val.
Could you tell me what awk '{printf $(NF-1)" "}' does?