Hi, this regular expression should do the trick.
Search for: (?s)\A.+VALUES(.+)\);/\*!.+\Z (small caveat: on a quick test this only worked with the cursor at the very top of the document. Don't have the time to figure out why) replace with \1 To turn it into an Applescript just record this search. Enjoy Roland Am 04.03.2010 um 00:38 schrieb Charles Hartley: > John, > > I'm afraid you're way over my head, but I'm interested in learning how to use > this. > > Thanks, > Charlie > > On Wed, Mar 3, 2010 at 4:50 PM, John Delacour <[email protected]> wrote: > At 12:56 -0800 3/3/10, you wrote: > > I will have a set of files that follow a pattern of > (1) disposable header text that always ends with "VALUES (" which is > found only once in the text. > (2) the required data that I must preserve. > (3) disposable footer text that always begins with ");/*!" which is > also found only once in the text. > > I need to create an appleScript that will automate this regardless of > the other contents of each of these sections. Is this doable, and if > so, can you suggest how? > > > I wouldn't bother with AppleScript but create a UNIX filter something like > this: > > #!/usr/bin/perl > my $print; > while (<>) { > s~.*VALUES \((.*)~$1~ and $print=1; > s~(.*)\);/\*!.*~$1~ and print $1 and $print=0 and $last=1; > print if $print; > last if $last; > } > > JD > > -- > 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. > > > -- > 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. -- 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.
