Support custom separator and ending strings
authorSiraaj Khandkar <siraaj@khandkar.net>
Wed, 13 Oct 2021 19:47:27 +0000 (15:47 -0400)
committerSiraaj Khandkar <siraaj@khandkar.net>
Wed, 13 Oct 2021 19:47:27 +0000 (15:47 -0400)
list

diff --git a/list b/list
index 2c518e8..6309b9c 100755 (executable)
--- a/list
+++ b/list
@@ -1,15 +1,22 @@
 #! /usr/bin/awk -f
 
+BEGIN {
+    sep = sep ? sep : " "
+    end = end ? end : ""
+}
+
 ! /^\#/ && ! /^$/ {
     xs[$1]++
 }
 
 END {
+    _sep = ""
     for (x in xs) {
         if (xs[x] > 1) {
             printf ">>> [WARNING] : '%s' was listed %d times.\n", x, xs[x] > "/dev/stderr"
         }
-        printf("%s%s", sep, x)
-        sep = " "
+        printf("%s%s", _sep, x)
+        _sep = sep
     }
+    printf "%s", end
 }
This page took 0.029669 seconds and 4 git commands to generate.