On 11/10/2017, at 02:30, Georg Portenkirchner <[email protected] 
<mailto:[email protected]>> wrote:
> I have a list that I want to sort in reverse order.


Hey Georg,

Rich has provided an elegant Perl filter.

#!/usr/bin/env perl
print reverse <>;

Just for fun here's how you can do it with AppleScript:

------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2017/11/10 20:30
# dMod: 2017/11/10 20:39 
# Appl: BBEdit
# Task: Reverse Lines of Selection - or whole document if there is NO selection.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Reverse, @Lines, @Selection, @Document
------------------------------------------------------------------------------

tell application "BBEdit"
    
    set theTarget to selection
    
    if length of theTarget = 0 then set theTarget to front text window
    
    set theLines to contents of lines of text of theTarget
    
    if theLines ≠ {} then
        set AppleScript's text item delimiters to linefeed
        set theLines to ((reverse of theLines) & "") as text
    end if
    
    set contents of theTarget to theLines
    
end tell

------------------------------------------------------------------------------

--
Best Regards,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
--- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/bbedit.

Reply via email to