changeset 17:75e0d0013da0

use awk for simple cut
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Sun, 07 Aug 2022 13:57:28 +0100
parents 04464ee31d66
children 046dbe557911
files bin/acut
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/acut	Sun Aug 07 13:57:28 2022 +0100
@@ -0,0 +1,6 @@
+#!/bin/bash
+# Use awk to do cut -d whitespace
+declare ff=("$@")
+join_array() { local IFS=\$; echo "$*"; }
+s=$(join_array "${ff[@]}")
+awk '{print '\$${s/\$/,\$}\}