• 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
awk question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

awk question


  • Subject: awk question
  • From: "John C. Welch" <email@hidden>
  • Date: Fri, 01 Dec 2006 12:08:03 -0600
  • Thread-topic: awk question

Title: awk question
I'm running into a situation that I've not found a good example for via Google or other sources.

running a script that's designed to process some SNMP output. Awk is a good choice here, and it's being run via do shell script, but I have a twist that's giving me the irrits.

each line has two field delimiters. The most common one is a space. that's easy. The problem is in what I want to be column two, there’s a text string surrounded by double quotes that contains spaces. As an example:

17    "Security Update for Exchange 2000 Server (KB894549)"     zeroDotZero       application  2005-10-7,13:45:34.0

so I’m trying to get awk to run as “your field delimiters are spaces OR double quotes with any number of any characters or whitespace followed by double quotes”

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

ideas?

--
 "Microsoft is actually a secret Ferengi-Klingon alliance  designed to cripple the Federation. The Ferengi are doing  the marketing and the Klingons are writing the code."
 _______________________________________________
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: "Mark J. Reed" <email@hidden>
    • Re: awk question
      • From: Cameron Hayne <email@hidden>
    • Re: awk question
      • From: Luca Pozzato <email@hidden>
  • Prev by Date: Re: Odd or even numbers
  • Next by Date: Re: awk question
  • Previous by thread: Re: Odd or even numbers
  • Next by thread: Re: awk question
  • Index(es):
    • Date
    • Thread