Re: awk question
Re: awk question
- Subject: Re: awk question
- From: "Mark J. Reed" <email@hidden>
- Date: Fri, 1 Dec 2006 15:07:46 -0500
On 12/1/06, Mark J. Reed <email@hidden> wrote:
my @fields = ();
push (@fields, $1||$2) while (/"([^"]*)"|(\S+)/g)
I should provide context in case you aren't familiar with Perl but
would like to incorporate the snippet above. If you create a file
containing this:
#!/usr/bin/perl
while (<>)
{
chomp;
my @fields = ();
push (@fields, $1 || $2 ) while /"([^"*])"|(\S+)/g;
# your code here.
# $fields[0] is the first field (awk's $1), $fields[1] is the 2nd, etc.
# the entire line (awk's $0) is in $_
}
and put execute permission on it, you can then run it with e.g.
do shell script "/path/to/script /path/to/input/file"
--
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