Re: awk question
Re: awk question
- Subject: Re: awk question
- From: Martin Orpen <email@hidden>
- Date: Sat, 16 Dec 2006 12:52:35 +0000
On 15 Dec 2006, at 19:34, Mark J. Reed wrote:
On 12/15/06, Martin Orpen <email@hidden> wrote:
awk 'BEGIN { FS=" +"; OFS=" | " } { print $1, $2, $3, $4,
$5 }'
He shoots, he scores...
Offensive foul!
That may happen to work on the sample data (though not quite, since it
leaves the quotation marks in the field value), but it doesn't
generalize. With some extra code to strip the quotes off, it might
even be good enough for John's actual data set, but it doesn't meet
the stated objective. A quoted string containing two adjacent spaces
will get split; two unquoted words with only a single space between
them will get joined.
It may not meet "your" stated objective Mark, but it gets the job
done, but let me remind you of John's "stated objective":
I can get close, but not close enough to what I want which would be:
$1 = 17
$2 = "Security Update for Exchange 2000 Server (KB894549)"
$3 = zeroDotZero
$4 = application
$5 = 2005-10-7,13:45:34.0
Which is what you get by simply typing:
awk 'BEGIN { FS=" +"} { print $1, $2, $3, $4, $5 }'
I do appreciate what you are getting at when you mention "generalize"
- and I wish I had the time to learn how to build applications that
can handle all eventualities. But I'm not interested in playing at
being a programmer - I'm a pre-press guy looking to automate the
dullest tasks and, in my world of the "quick fix", awk and
AppleScript are very useful tools.
Regards
--
Martin Orpen
Idea Digital Imaging Ltd
_______________________________________________
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