For the general case, there is never any reason to pipe the output of grep into awk ; awk can easily do the work grep does without invoking both awk and grep .
Is there ever any reason to set a variable to a known string and then write commands to split that known string into substrings? If you know the components of your string; you know the substrings as well. Why not just set the substrings directly?
If your data is in a file, why are you splitting out lines from that file and echoing them into pipelines instead of just feeding the file directly into awk as an input operand?
This thread looks like someone is showing us a tree when we need to take a step backwards and look at the forest. What are you really trying to do here?