Multiple Search With Grep

85 views
Skip to first unread message

phendee

unread,
Mar 2, 2009, 12:10:31 PM3/2/09
to TextWrangler Talk
I have a form on my website that sends me information on customers. I
receive an e-mail of the form results when the client clicks the
"Submit" button. I save this e-mail as a Text file and open it with
TextWrangler. In TextWrangler I need to search for multiple items and
then replace them all with a Tab (\t). The items to be searched for
are:
\rFirstname:
\rLastname:
\rCity:
\rState/Prov:
\rZip/Postal Code:
\rCountry:
\rArea Of Occupation:
\rArea Of Interest:
\rMy Energy Forever "You Asked For It" Comments::
\rTo receive information on alternate energy fuels and processes:

After each of the colons above is a space.

Though I'm reading the Tutorial on Grep, I cant even figure out how to
start. Can anyone help?

Christopher Bort

unread,
Mar 2, 2009, 12:38:49 PM3/2/09
to textwr...@googlegroups.com

What exactly do you need to replace with \t? The '\rfieldname:
'? If so, then

search pattern:

\r[^:]+:+<space>

replace pattern:

\t

Figuring out what the above search pattern matches is left as a
(not too difficult) exercise for the reader. 8^) The manual
sections on character classes and quantifiers will lead you
through it. Refining it to handle, say, multiple space or white
space characters after the colon is left as a further exercise.

--
Christopher Bort
<top...@thehundredacre.net>
<http://www.thehundredacre.net/>

phendee

unread,
Mar 2, 2009, 1:32:19 PM3/2/09
to TextWrangler Talk
I tried the search string you gave me. Many Thanks. Unfortunately,
the search found nothing. What you described is exatly what I need to
do to make a Tab Deliminated document that will open in MS Excel.
However, when I pasted your search into my document and clicked
"Search" (just to test the Search part) I got nothing.

On Mar 2, 12:38 pm, Christopher Bort <top...@thehundredacre.net>
wrote:

Christopher Bort

unread,
Mar 2, 2009, 1:46:11 PM3/2/09
to textwr...@googlegroups.com
On 03/02/09 10:32, phe...@thedataorchard.com (phendee) wrote:

> I tried the search string you gave me. Many Thanks. Unfortunately,
> the search found nothing. What you described is exatly what I need to
> do to make a Tab Deliminated document that will open in MS Excel.
> However, when I pasted your search into my document and clicked
> "Search" (just to test the Search part) I got nothing.

Replace <space> in my pattern with a literal space character.

Reply all
Reply to author
Forward
0 new messages