• 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: Regex in OS X
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regex in OS X


  • Subject: Re: Regex in OS X
  • From: Walter Ian Kaye <email@hidden>
  • Date: Fri, 6 Feb 2004 14:26:50 -0800

At 03:59p -0500 02/06/2004, Hanaan Rosenthal didst inscribe upon an electronic papyrus:

I'm having to deal with searching through text containing thousands of
lines for matches.
The text is tab delimited, where one field contains the wrong word and
the second contains the right word. I'm using it as the dictionary for
search and replace.
The text looks like that:
"GM General Motors
Macdonalds McDonalds
MicroSoft Microsoft
etc..."

I know Satimage has some regular expressions to handle such a thing.
Would anyone (Emmanuel) have some code that will return the line that
contains a match at the start of the line. Example:
Search string: "Macdonalds"
Result is the line:
"Macdonalds McDonalds"
Since it starts with the search string.

`grep` will do what you want, and you can call it via 'do shell script'.
check out `man grep` to study the syntax.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Regex in OS X (From: Hanaan Rosenthal <email@hidden>)

  • Prev by Date: Re: Regex in OS X
  • Next by Date: Re: Shell-sandwich a file in 2 variable strings
  • Previous by thread: Re: Regex in OS X
  • Next by thread: OSASubr
  • Index(es):
    • Date
    • Thread