aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-110/abigail/awk/ch-2.awk31
1 files changed, 31 insertions, 0 deletions
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)
+ }
+}