Hi grail,
Never used it before, but now you have me wanting to dive into awk.
I looked it up on :
http://www.grymoire.com/Unix/Awk.html
I see how most of it works, except for the way gsub is performing the substituion.
From the example : {gsub(/\(.*/," "exponent)
From what I understand intuitively, the printed output is filtered through the gsub str subst function. The part I am trying to wrap my brain around is the brackets.
So far, since gsub is a function, I assume gsub() is the function text.
So the next part is to match the content within the slashes : /\(.*/
This grabs all text from the ( character through to the end of the line of text. The bracket is dereferenced as \( so it is interpeted correctly as text and not a function statement bracket.
The comma is the argument separator within the gsub function, then the following text that will be used for substitution is : " "exponent
Where the word exponent is a variable that has been set by the pattern matching in the first part of the awk statement. So the result is that a space character followed by the contents of variable named exponent - that has been set by the conditional substitution in the first part of the awk statement - is printed.
Do I have it right? Thanks, and nice solution.