Re: Grep help with tide table formatting

2011-11-10 Thread John Gold
Question -- Now that you've laid it out, I understand what the
expression does, except for the \1 at the end of the search pattern.
What does that do?

Thanks again!

John


On Nov 10, 9:22 am, John Gold j...@pointseast.com wrote:
 Hey -- thank you very much. I'll give that a try!

 John

 On Nov 10, 1:33 am, Alex Satrapa gr...@goldweb.com.au wrote:







  On 10/11/2011, at 09:23 , John Gold wrote:

   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

  My first attempt:

  Find:         ^(\d+)(.*)\r\1
  Replace with: \1\2\t\1

  This will require a couple of passes since it matches the lines by pairs.

  Hope this helps!
  Alex

   smime.p7s
  2KViewDownload

-- 
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


Grep help with tide table formatting

2011-11-09 Thread John Gold
I am trying to reformat tide tables from NOAA. The data comes in this
format:

1   4:09 AM 17.6H
1   10:30 AM2.3 L
1   4:34 PM 16.8H
1   10:52 PM2.3 L
2   5:02 AM 17.3H
2   11:24 AM2.5 L
2   5:30 PM 16.3H
2   11:45 PM2.7 L
3   5:56 AM 17.3H
3   12:20 PM2.5 L
3   6:26 PM 16.2H

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.6H  110:30 AM2.3 L  14:34 PM 16.8
H  110:52 PM2.3 L
2   5:02 AM 17.3H  211:24 AM2.5 L  25:30 PM 16.3
H  211:45 PM2.7 L
3   5:56 AM 17.3H  312:20 PM2.5 L  36:26 PM 16.2
H

I'm thinking there might we a way to do it via GREP?

FYI -- counting lines won't work, because the number of lines for each
common number varies between 3 and 4 (depending upon how many tide
cycles there are in the day.

Any help would be appreciated.

Thanks,

John

-- 
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