diff options
| author | Abigail <abigail@abigail.be> | 2021-05-18 15:40:54 +0200 |
|---|---|---|
| committer | Abigail <abigail@abigail.be> | 2021-05-18 15:40:54 +0200 |
| commit | 47bbd47bcea6fe7126654cd517425b9c5777b2ed (patch) | |
| tree | 0b16c8ed873567ae07e87ced0e3e6582ec98252f /challenge-113/abigail/awk | |
| parent | fe3a870ec5d417066f620307c01411f42422c0a3 (diff) | |
| download | perlweeklychallenge-club-47bbd47bcea6fe7126654cd517425b9c5777b2ed.tar.gz perlweeklychallenge-club-47bbd47bcea6fe7126654cd517425b9c5777b2ed.tar.bz2 perlweeklychallenge-club-47bbd47bcea6fe7126654cd517425b9c5777b2ed.zip | |
AWK solution for week 113, part 2
Diffstat (limited to 'challenge-113/abigail/awk')
| -rw-r--r-- | challenge-113/abigail/awk/ch-2.awk | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/challenge-113/abigail/awk/ch-2.awk b/challenge-113/abigail/awk/ch-2.awk new file mode 100644 index 0000000000..2d9d9ab2a7 --- /dev/null +++ b/challenge-113/abigail/awk/ch-2.awk @@ -0,0 +1,23 @@ +#!/usr/bin/awk + +# +# See ../README.md +# + +# +# Run as: awk -f ch-2.awk < input-file +# + +{ + sum = 0 + for (i = 1; i <= NF; i ++) { + sum += $i + } + for (i = 1; i <= NF; i ++) { + if (i > 1) { + printf " " + } + printf "%d", sum - $i + } + printf "\n" +} |
