Am 08.07.2012 um 8, 13:59 schrieb Mosby:

> I have data that looks similar to this...
> 
> 75092 Sherman 1811 Whao
> 75090 Sherman . at. 8am 
> 3244 Dripping Springs Rd
> 903-647-3292 veryt
> 75092 Sherman 3204 M
> 75409 Anna    Tooehold item
> 
> There are tabs after the zip codes.
> 
> I want to skip the zip codes and only find the lines that do not begin with a 
> zip code.  Once those lines are located I want to remove the return at the 
> end of the previous line and replace it with a space.  Every GREP pattern I 
> have tried to use always finds the zip code as well.  There are tabs only 
> after the zip codes, no tabs are found on the other lines.
> 
> Thanks for any help.

Additional to the fine solutions already given: If you can bear doing two 
search-replace operations (and assuming the whole file contains only lines as 
in your example):

Step 1)
search: \r
replace: ' ' (<-- a space, without the brackets)

--> this removes all line breaks in the file

Step 2)
search: (\d+\t)
replace: \r\1 

--> this puts line breaks back in, just before every zip code leaving only 
lines that start with a zip codes.

I don't think, this solutions is better than the others, I just wanted to show, 
that there are several ways to solve a grep problem. I know, for real grep 
masters the challenge lies in finding a pattern that solves the problem in one 
go but for me (having only limited grep fu) finding a simple, more 
comprehensible solution has it's appeal, too.

Regards,
Roland

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to