From 212821b85e7bcdcfa6d69644c68824381d349e25 Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Wed, 13 Oct 2021 15:47:27 -0400 Subject: [PATCH] Support custom separator and ending strings --- list | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 } -- 2.20.1