On Nov 9, 2011, at 4:23 PM, John Gold wrote:

> I am trying to reformat tide tables from NOAA. The data comes in this
> format:
> 
> 1     4:09 AM 17.6    H
> 1     10:30 AM        2.3     L
> 1     4:34 PM 16.8    H
> 1     10:52 PM        2.3     L
> 2     5:02 AM 17.3    H
> 2     11:24 AM        2.5     L
> 2     5:30 PM 16.3    H
> 2     11:45 PM        2.7     L
> 3     5:56 AM 17.3    H
> 3     12:20 PM        2.5     L
> 3     6:26 PM 16.2    H
> 
> Each field is separated by a tab, each line has a return. I want to
> group all the lines that begin with a common number (1, 2, 3, etc.)
> into a single line, like this:
> 
> 1     4:09 AM 17.6    H  1    10:30 AM        2.3     L  1    4:34 PM 16.8    
> H  1    10:52 PM        2.3     L
> 2     5:02 AM 17.3    H  2    11:24 AM        2.5     L  2    5:30 PM 16.3    
> H  2    11:45 PM        2.7     L
> 3     5:56 AM 17.3    H  3    12:20 PM        2.5     L  3    6:26 PM 16.2    
> H

I think this will work, but will require multiple passes thru the data:

        Search:  ^((\d+)\t.+?)\r(\2\t.+?)$

        Replace:  \1\t\3

-- 
Rod Buchanan
KDSI / Kelly Supply Co / ISCO
308 382-8764 x220

Change is inevitable, except from a vending machine.

-- 
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to