aboutsummaryrefslogtreecommitdiff
path: root/challenge-110/abigail/awk/ch-2.awk
blob: ec9f1acd36e47eba8b0a675fe62b3f6c80d9dada (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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)
    }
}