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

Re: Help with simple grep


  • Subject: Re: Help with simple grep
  • From: email@hidden
  • Date: Fri, 29 Aug 2008 13:57:21 -0400


I am at work and guessing...

set y to do shell script "mdls -name kMDItemPixelHeight " & quoted form of x & "| grep -o '*[0-9]*'"

Charles Profitt
Sr. Network Technician
BrainBench Certified - (Master)Microsoft Security | (Master)Storage Area Networks Concepts | (Master)Microsoft Vista Desktop Administration | (Master)Macintosh OS X 10.4 Desktop Administration
75 Barker Road
Pittsford, NY 14534

Important Notice:
This communication, including any attachments, is intended only for the use of the individual(s) or entity(s) to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this communication is not the intended recipient, you are hereby notified that any dissemination, distribution or reproduction of any part of this communication in any format is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to this communication and deleting the original and any automatically generated copies. Thank-you for your co-operation.



Joe <email@hidden>
Sent by: applescript-users-bounces+chas_profitt=email@hidden

08/29/2008 01:48 PM

To
email@hidden
cc
Subject
Help with simple grep





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 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
References: 
 >Help with simple grep (From: Joe <email@hidden>)

  • Prev by Date: Help with simple grep
  • Next by Date: Re: Help with simple grep
  • Previous by thread: Help with simple grep
  • Next by thread: Re: Help with simple grep
  • Index(es):
    • Date
    • Thread