[ILUG] Gawk query
paul at clubi.ie
paul at clubi.ie
Thu Aug 23 19:09:14 IST 2007
On Thu, 23 Aug 2007, Paschal Nee wrote:
> i.e. recognising that [] and "" enclose single fields.
Set the Output Record Seperator according to whether the 'special'
delimiter set is open or not:
{
open = 0;
for (i = 1; i <= NF; i++) {
if ($i ~ /^[\["]/)
ORS = " ";
print $i;
if ($i ~ /[\]"]$/) {
ORS = "\n";
print "";
}
}
if (ORS = " ")
ORS="\n"
}
This treats the special delimiters as equivalent, but i that's
generally unparseable.
regards,
--
Paul Jakma paul at clubi.ie paul at jakma.org Key ID: 64A2FF6A
Fortune:
QOTD:
"I've got one last thing to say before I go; give me back
all of my stuff."
More information about the ILUG
mailing list