I am working on a very basic WYSIWYG HTML editor in apple script using an editable web view. I am using grep for string replacement. More specifically for searching for strings to be replaced for eventually adding html tags like
and
to the selected string. The link above was beyond valuable to me.
Might not help you specifically but might help others:
Both BBEdit and MailSmith (both by Barebones Software) have some very straightforward instuctions for using GREP syntax (i.e. how to make a search string), since both support it for searches and filtering.
I’m thinking awk might be better? You can ajust the delimiters by using the -F option. ie: if there are tabs betwen the fields you would say “awk -F \t …”
echo "2 Mar 11:21:26 ntpdate[16462]: adjust time server 123.45.67.89 offset 0.021 sec" | awk '{print $10}'
set test to "2 Mar 11:21:26 ntpdate[16462]: adjust time server 123.45.67.89 offset 0.021 sec"
do shell script "echo " & quoted form of test & " | /usr/bin/grep -o 'offset.*\\?sec'"
set someVar to text 7 thru -5 of result