• 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
Help with simple grep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help with simple grep


  • Subject: Help with simple grep
  • From: Joe <email@hidden>
  • Date: Fri, 29 Aug 2008 10:47:13 -0700

I would like to return only the numeric portion of the string produced by the following script. The example returns "return character, space character, 188" and I'm looking for just "188"

set pth to alias "D1:Users:joe:Pictures:Photos-Scans:500.jpg"
tell application "Finder" to set x to POSIX path of pth
set y to do shell script "mdls -name kMDItemPixelHeight " & quoted form of x & "| grep -o ' [0-9]*'"
-->"
 188"

I tried removing the space before [0-9] but that only returns an empty string.

The only reference for grep I have is the chapter in the BBEdit manual v6. Could you also suggest a good reference for grep?

Joe
 _______________________________________________
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/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Help with simple grep
      • From: Ronald Hofmann <email@hidden>
    • Re: Help with simple grep
      • From: Jon Pugh <email@hidden>
    • Re: Help with simple grep
      • From: email@hidden
  • Prev by Date: Re: scope problem
  • Next by Date: Re: Help with simple grep
  • Previous by thread: How to add a new slider with some text in Keynote?
  • Next by thread: Re: Help with simple grep
  • Index(es):
    • Date
    • Thread