This works on your sample text. Be sure to check it if you use it over a larger data set.
Start by searching for the regular expression: # (\d{4}-\d{2}-\d{2})\sItem,Value,Value Percent,Conversions,Conversion Percent,URL,Clicky URL\s"(http://.+?html(foo)*)",(\d+)[0-9,\.]+"http://.+?html(foo)*",""\s(("http://.+?html(foo)*"),(\d+)[0-9,\.]+"http://.+?html(foo)*","")* Replace that pattern with the following: \1\t\2\t\4\r\6 Then search for this regular expression: ((\d{4}-\d{2}-\d{2})\t.+?\t\d+\s)"(http://.+?html(foo)*)",(\d+)[0-9,\.]+"http://.+?html(foo)*",""\s And replace it with: \1\2\t\3\t\5 On Tue, May 11, 2010 at 3:49 PM, Lorin Rivers <lriv...@mosasaur.com> wrote: > I have this: > # 2009-09-28 > Item,Value,Value Percent,Conversions,Conversion Percent,URL,Clicky URL > "http://online.foo.com/static_html_files/jsframe.html",120,98.4,,,"http://online.foo.com/static_html_files/jsframe.html","" > "http://europe.foo.com/static_html_files/jsframe.html",1,0.8,,,"http://europe.foo.com/static_html_files/jsframe.html","" > > # 2009-09-27 > Item,Value,Value Percent,Conversions,Conversion Percent,URL,Clicky URL > "http://online.foo.com/static_html_files/jsframe.html",65,97,,,"http://online.foo.com/static_html_files/jsframe.html","" > > # 2009-09-26 > Item,Value,Value Percent,Conversions,Conversion Percent,URL,Clicky URL > "http://online.foo.com/static_html_files/jsframe.html",73,100,,,"http://online.foo.com/static_html_files/jsframe.html","" > > # 2009-09-25 > Item,Value,Value Percent,Conversions,Conversion Percent,URL,Clicky URL > "http://online.foo.com/static_html_files/jsframe.htmlfoo",144,100,,,"http://online.foo.com/static_html_files/jsframe.htmlfoo","" > > # 2009-09-24 > Item,Value,Value Percent,Conversions,Conversion Percent,URL,Clicky URL > "http://online.foo.com/static_html_files/jsframe.htmlfoo",159,99.4,,,"http://online.foo.com/static_html_files/jsframe.htmlfoo","" > "http://europe.foo.com/static_html_files/jsframe.htmlfoo",1,0.6,,,"http://europe.foo.com/static_html_files/jsframe.htmlfoo","" > > > and I want > 2009-09-28 http://online.foo.com/static_html_files/jsframe.html 120 > 2009-09-28 http://europe.foo.com/static_html_files/jsframe.html 1 > 2009-09-27 http://online.foo.com/static_html_files/jsframe.html 65 > > The date that is after the # at the beginning of every line that follows it > unless that line is empty or starts with Item. If the line starts with #, > that's a date line and so switch to the new date and continue. Does that make > sense? > > I think it can be done with grep, but I am not a Jedi in that art. > > -- > Lorin Rivers > Mosasaur: Killer Technical Marketing <http://www.mosasaur.com> > <mailto:lriv...@mosasaur.com> > 512/203.3198 (m) > > > -- > 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. -- 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.