Quote:
Originally Posted by David the H.
@Firerat, Nicely done. Just a couple of quick suggestions. "print" on its own is the same as "print $0",
|
Ahh yes, an old habit of mine always using $0
I think it is because I'm usually including some extra strings to the output.
Quote:
Originally Posted by David the H.
and an "else" would probably be a better choice to connect the two commands, rather than "next".
|
Very true, I think it is the first time I have ever used next in an awk, not that I have really done that many.
Quote:
Originally Posted by David the H.
I believe you could also reduce it down to just this (untested, 'cause I'm lazy):
Code:
awk '$1 == "SRIG_NAME:" { FileName = $NF } { print >> FileName".txt" }' DataDictionary.txt
|
It works fine.. with one slight downside.
As it appends the output, without proper housekeeping multiple runs will result in duplicate data.
Which is no show stopper really.