On Sat, Mar 23, 2013 at 8:39 PM, Jim Walker <tvcne...@gmail.com> wrote:
> Can I pay someone to write a script which I can added to BBedit > so I can run the scripts, like linesort used to work, and get the totals > like below? > Oh goodness, don't pay anyone to write simple shell scripts for you when the Internet is chock full of nerds who will do that for free ;-) Here's the script you need for a Text Filter in BBEdit: #!/bin/sh /usr/bin/sort --numeric-sort "$@" |\ /usr/bin/uniq -c |\ /usr/bin/sort --numeric-sort exit 0 #EOF (What That Script Does: line 1 will sort the contents of the file, line 2 will combine duplicate lines and prefix it with a count of how many lines matched that line, and line 3 will sort that again so that the lines which have the most duplicates will be at the bottom of the list.) To use this: * Copy the above into a new BBEdit document and make sure that the "#!/bin/sh" line is the first line in the file * Save it to ~/Application Support/BBEdit/Text Filters/ (or "~/Dropbox/Application Support/BBEdit/Text Filters/" if you sync via Dropbox) * name it something like "Linesort With Totals.sh" * find it under the Text Filters menu: http://images.luo.ma/bbedit/linesort/linesort-as-text-filter.jpg NOTE: TextFilters will REPLACE the content of your file. If you want to leave the contents of the file alone and have the output of "Linesort With Totals.sh" to appear in another BBEdit file, you should use it as a BBEdit _Script_ which means: Use this script instead: #!/bin/sh /usr/bin/sort --numeric-sort "$BB_DOC_PATH" |\ /usr/bin/uniq -c |\ /usr/bin/sort --numeric-sort exit 0 #EOF * put it into "~/Application Support/BBEdit/Scripts/" (or "~/Dropbox/Application Support/BBEdit/Scripts/" * find it under the 'scripts' menu: http://images.luo.ma/bbedit/linesort/linesort-as-script.jpg BTW I have created a script which can be used as _either_ a Text Filter _or_ a BBEdit Script. You can find it here: http://images.luo.ma/bbedit/linesort/Linesort%20With%20Totals.sh (to download it, go to http://images.luo.ma/bbedit/linesort/ and then control+click on the ".sh" file) No guarantees, use at your own risk, if it breaks you get to keep both parts, but it worked for me. TjL (Shell Script Nerd since the early 1990s) -- -- You received this message because you are subscribed to the "BBEdit Talk" discussion group on Google Groups. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com For more options, visit this group at <http://groups.google.com/group/bbedit?hl=en> 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: <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 bbedit+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.