RE: Find text
RE: Find text
- Subject: RE: Find text
- From: Javi Pérez <email@hidden>
- Date: Fri, 20 Apr 2012 16:58:09 +0200
This was a PRO answer, thanks
Enviado con
El viernes 20 de abril de 2012 a las 16:45, Christopher Stone escribió:
set myList to "SMB NORTHBRIDGE CHIP DIE: 51 C
SMC BATTERY: 35 C
SMART Disk Hitachi HTS545050B9SA02 (100826PBL40017J9VZTV): 32 C
SMC BATTERY POSITION 2: 35 C
"
# Grep
set foundLine to do shell script "egrep -i 'disk' <<< " & quoted form ofmyList
# Sed
set foundLine to do shell script "sed -n '/[dD]isk/p' <<< " & quoted form ofmyList
# Awk
set foundLine to do shell script "awk '/[dD]isk/' <<< " & quoted form ofmyList
# Perl
set foundLine to do shell script "perl -wlne 'if (m/(?ims)(^.+disk.+)/) {print \"$1\"}' <<< " & quoted form of myList
set foundLine to find text ".+disk.+" in myList with regexp and string resultwithout case sensitive
tell application "ASObjC Runner"
set foundLine to look for "^.+disk.+" in myList options "im"
if foundLine is not {} then set foundLine to item 1 of foundLine
end tell
_______________________________________________
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: | |
| >Find text (From: Javi Pérez <email@hidden>) |
| >Re: Find text (From: Christopher Stone <email@hidden>) |