>>> Can I do a 'sort lines...' based on how many times a particular character
>>> appears in the line?
Thanks all for helping me sort this out.
The end result is the following applescript talking to a perl filter, both
stored in the relevant places in Application Support>BBEdit.
tell application "BBEdit"
activate
select text of text window 1
run unix filter {file "HD:Users:rich:Library:Application¬
Support:BBEdit:Unix Support:Unix Filters:count commas.pl"}
sort lines selection of text window 1 sorting options {sorting¬
numerically:true} output options {replacing target:true}
replace "^.*\\t" using "" searching in text 1 of text document 1 ¬
options {search mode:grep, starting at top:true, wrap around:false,¬
backwards:false, case sensitive:false, match words:false, extend¬
selection:false}
end tell
count commas.pl:
#!/usr/bin/perl
while(<>){
m/.*\\(.*)/;
print $1 =~ tr/,/,/, "\t", $_;
}
Cheers
Rich
--
>From Richard A Clarke on 4/6/06 12:32 am:
> From Peter N Lewis on 3/6/06 6:19 am:
>
>>> Can I do a 'sort lines...' based on how many times a particular character
>>> appears in the line?
>>
>> Not directly.
>>
>> I suggest you first translate the file to start with <count of
>> commas><tab>, then sort numerically, then remote the leading count.
--
------------------------------------------------------------------
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]>