At 12:22 -0800 11/21/2012, Mr. J wrote:
>when i use that grep you just gave me it deletes the entire document..
>my document looks like this:
>
>[ example data elided ]
>
>so the goal is to search for duplicate emails within the whole document
>and then delete those emails and their entire lines
If all the data follow the same patterns as your above example, i.e. each
line consists of either:
a) an email address, or
b) multiple comma delimited fields, the first of which is an email address
you needn't worry about matching addresses in detail, but can instead
"cheat" and just deal with them positionally. :-)
So, please give this a try:
Apply Text -> Delete Duplicate Lines set to `Leaving One` with the
"Duplicates to new document" and "Delete duplicate lines" options set, and
"Match using pattern" enabled with:
Searching pattern: ^(.+?@.+?)(|,.*)$
Match Using:
Specific sub-patterns: \1
I think the search pattern will make sense on its own, but if not, please
say so and I'll be happy to explain in more detail.
Also, as a general observation:
Though it's not absolutely necessary to bind search patterns for use with
TextWrangler's line processing commands to the line start and end (i.e. if
your pattern naturally limits itself to a single line), I recommend doing
so to avoid unexpected outcomes.
Regards,
Patrick Woolsey
==
Bare Bones Software, Inc. <
http://www.barebones.com/>