Script for extracting "line beginning"

Joined
Feb 26, 2015
Messages
1
Reaction score
0
Points
1
Hi all,

I'm new to Applescript. I'd like to extract certain lines from a text document using a script. For instance, I have a document with of contact info for people with the last name "Liu". I'd like to only extract the names:

Liu, Pingting
Type:
Student
Unit:
Finance 

Email:
[email protected]
Phone:
517-974-0598
Liu, Qi
Type:
Student
Unit:
Finance 

Email:
[email protected]
Phone:
864-748-2028x65
Liu, Qi
Type:
Student
Unit:
Landscape Architecture 

Email:
[email protected]

The only similarity of the lines i'd like to extract is "Liu," (including the comma).

Is there a way to extract only the "Liu," line, including the first name, so the final result is a text file:

Liu, Pingting
Liu, Qi
Liu, Qi

Thank you for your consideration!
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top