From d5c2a31cd0d4208c124d6f1306b9adf945a5baac Mon Sep 17 00:00:00 2001 From: Abigail Date: Thu, 29 Apr 2021 01:48:48 +0200 Subject: AWK solution for week 110, part 2 --- challenge-110/abigail/awk/ch-2.awk | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 challenge-110/abigail/awk/ch-2.awk diff --git a/challenge-110/abigail/awk/ch-2.awk b/challenge-110/abigail/awk/ch-2.awk new file mode 100644 index 0000000000..ec9f1acd36 --- /dev/null +++ b/challenge-110/abigail/awk/ch-2.awk @@ -0,0 +1,31 @@ +#!/usr/bin/awk + +# +# See ../README.md +# + +# +# Run as: awk -f ch-2.awk < input-file +# + +BEGIN { + FS = "," # This gives us an implicit split +} + +{ + # + # Build output strings in array out + # + for (i = 1; i <= NF; i ++) { + out [i] = out [i] "," $i + } +} + +END { + # + # Print the output strings + # + for (i = 1; i <= length (out); i ++) { + print substr (out [i], 2) + } +} -- cgit