Re: awk question
Re: awk question
- Subject: Re: awk question
- From: "Mark J. Reed" <email@hidden>
- Date: Fri, 1 Dec 2006 17:31:59 -0500
Minor corrections - for some reason there were spurious quotes at the
end of my field[fnum] assignment line, and I neglected to remove the
quotation marks from quoted fields. The below fixes those issues.
<datafile awk '{
fnum = 1
while (match($0,/"[^"]*"|[^ ][^ ]*/))
{
f = substr($0, RSTART, RLENGTH);
if (substr(f,1,1) == "\"")
{
f = substr(f, 2, length(f) - 2)
}
field[fnum++] = f
$0 = substr($0, RSTART + RLENGTH);
}
for (i=1; i<fnum; ++i)
{
print i": "field[i]
}
}'
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden