xcode user script - Apple Script - Sort selected lines by length

Posted by Bach on Stack Overflow See other posts from Stack Overflow or by Bach
Published on 2010-06-01T13:49:05Z Indexed on 2010/06/01 13:53 UTC
Read the original article Hit count: 212

Filed under:
|

I need to create a user scripts in xcode where I can sort a selection of multiple lines, by their length (number of characters)

I know of this macro variable PBXTextLength, but not sure how to write the script.

this is the sort selection script in Xcode:

echo -n "%%%{PBXSelection}%%%"
sort <&0
echo -n "%%%{PBXSelection}%%%"

how can i modify that script to sort the selection by the length of the line (PBXTextLength)?

thanks

© Stack Overflow or respective owner

Related posts about xcode

Related posts about applescript