From 1a4b8674ea76574fe1a0b1ed5eef6be6dd89cbed Mon Sep 17 00:00:00 2001 From: Thomas Levine <_@thomaslevine.com> Date: Sun, 6 Mar 2016 15:06:34 +0000 Subject: [PATCH] perl sort --- readme.md | 3 +++ urchin | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index dcd1148..1fb1e5c 100644 --- a/readme.md +++ b/readme.md @@ -51,6 +51,9 @@ Urchin uses sort to format its output. GNU sort (as of GNU coreutils version necessary for the output to look right. If your version of sort lacks this feature, Urchin will try to use one of the following tools for sorting. +* perl +* python + If no acceptable sorting program is available, Urchin will print a warning and use the incomplete sort that is installed on your system. This is not a big deal; if your test files all start with alphanumeric letters, the output diff --git a/urchin b/urchin index 329b3aa..a45bf7d 100755 --- a/urchin +++ b/urchin @@ -87,6 +87,10 @@ for line in sorted(sys.stdin.readlines()): ' } +sort_perl() { + perl -e 'print sort (<>);' +} + # All temporary files go here urchin_tmp=$(mktemp -d) > "${urchin_tmp}/log" @@ -603,7 +607,9 @@ main() { if test "${sort_result}" = edacb; then sort=sort else - if which python > /dev/null; then + if which perl > /dev/null; then + sort=sort_perl + elif which python > /dev/null; then sort=sort_python else echo 'Your version of sort sorts in dictionary order (-d) by default.