From: Siraaj Khandkar Date: Wed, 13 Oct 2021 19:47:27 +0000 (-0400) Subject: Support custom separator and ending strings X-Git-Url: https://git.xandkar.net/?p=khome.git;a=commitdiff_plain;h=212821b85e7bcdcfa6d69644c68824381d349e25 Support custom separator and ending strings --- diff --git a/list b/list index 2c518e8..6309b9c 100755 --- 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 }