From df7cd7249c04cfe116aba64258b512c897fd9ef4 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Fri, 26 May 2017 15:42:39 +0200 Subject: mcom: commajoin: use awk The sed solution did not work with OpenBSD sed and Plan9 sed when only one line was used. --- mcom | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'mcom') diff --git a/mcom b/mcom index 03823b7..892fee1 100755 --- a/mcom +++ b/mcom @@ -2,7 +2,9 @@ # mcom [TO] - compose mail commajoin() { - sed ':a;N;s/\n/, /;$!b a' + awk 'NR==1 {l=$0; next} + {l=l", "$0} + END {print l}' } notmine() { -- cgit 1.4.1