On 2 Jun 2006, at 22:49, Richard A Clarke wrote:

Can I do a 'sort lines...' based on how many times a particular character
appears in the line?

It's not difficult to do if you can define a custom sort handler in your scripting language. For example, in newLISP (wot I use):

(set 'contents (parse (read-file ((main-args) 2)) "\n"))
(sort contents
        (fn (a b)
                (<   (count (list ",") (explode a))
                        (count (list ",") (explode b)))))
(map println contents)

will sort the lines into ascending comma-count order. Not too quick, but short.

You could write something similar in AppleScript (a bit more work, though :-)).

Pete


--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to