• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: awk question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: awk question
      • From: "John C. Welch" <email@hidden>
    • Re: awk question
      • From: "Mark J. Reed" <email@hidden>
References: 
 >awk question (From: "John C. Welch" <email@hidden>)
 >Re: awk question (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: awk question
  • Next by Date: Re: awk question
  • Previous by thread: Re: awk question
  • Next by thread: Re: awk question
  • Index(es):
    • Date
    • Thread