At 9:48 PM +0100 7/5/10, John Delacour sent email regarding Re: Flip a Table:
At 10:37 -0700 5/7/10, Warren Michelsen wrote:

...I'm guessing that Perl is the best tool for this job. It has a reverse function so I'm guessing that the original selection could be read into an array, using "<tr" and "/tr>" as delimiters, then regurgitated in reverse order of the original.


How you do it will depend on where your line-breaks are.  If your file reads

<tr>1</tr>
<tr>2</tr>
<tr>3</tr>
<tr>4</tr>
<tr>5</tr>

then it is simple. Just write the following little routine, select the lines in the document you want to reverse and run the script.


#UNIX SCRIPT:

Is this a Perl script? Should it start with:
#!/usr/bin/perl

?




while (<>) {
  chomp;
  push @_, $_
}
for (reverse @_){
  next if /^$/; # ignore blank lines
  print "$_\n";
};

Run the above script from the palette or with a key-shortcut to get:


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

Reply via email to