Re: Filter to reverse order of lines

2017-11-17 Thread Rich Siegel
On 11/17/17 at 6:36 AM, ms...@podiuminternational.org (Marek 
Stepanek) wrote:



I would like to reverse the order of a selected lines with a BBEdit
filter. Best with Perl.


Just last week, in fact. :-) 


Enjoy,

R.
--
Rich Siegel Bare Bones Software, Inc.
  

Someday I'll look back on all this and laugh... until they 
sedate me.


--
This is the BBEdit Talk public discussion group. 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: 
--- 
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: Filter to reverse order of lines

2017-11-17 Thread Mark Damon Hughes
> On Nov 17, 2017, at 03:36, Marek Stepanek  
> wrote:
> Hello all!
> I would like to reverse the order of a selected lines with a BBEdit
> filter. Best with Perl.

I'm sure there's a Perl one-liner, but the Python script I use is:

#!/usr/bin/env python3
import sys
with sys.stdin as f:
lines = f.readlines()
lines.reverse()
for l in lines:
sys.stdout.write(l)
sys.stdout.flush()

-- 
 Mark Damon Hughes
 

-- 
This is the BBEdit Talk public discussion group. 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: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Filter to reverse order of lines

2017-11-17 Thread Marek Stepanek

Hello all!


I would like to reverse the order of a selected lines with a BBEdit
filter. Best with Perl.

My approach is something like follows:

#!/usr/bin/local/perl

use File::ReadBackwards;
use warnings;
use strict;

tie *BW, 'File::ReadBackwards', (<>) or
   die "can't read selected text $!" ;

   while(  ) {
   print ;
   }


Is there somebody who could help me with this?


Best greetings to all from Munich


marek

-- 
This is the BBEdit Talk public discussion group. 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: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.