When all you need to do is print certain fields in a string, bash arrays and/or parameter substitution
can often be good alternatives to awk, sed, grep, and cut. The external tools are generally better (and often more efficient) when more complex processing is required, such as when complex regex patterns are required to match text or when targeting only certain lines in a file or such.
By the way, I was wondering why you were using IFS=$'\012'
in your script instead of IFS=$'\n'
. That seemed a bit odd to me, since you used \n elsewhere in the script.
@grail: As usual, another nice solution. But he did mention that this was for inclusion in a larger script. It would have to be converted to a stand-alone command for in-script use, and the output likely captured in a bash variable for further use.