mirror of
https://github.com/wezm/advent-of-code.git
synced 2024-12-18 10:19:55 +00:00
2023: Day 1, tweak to just use chimerautils
This commit is contained in:
parent
140ec1f33c
commit
f213f6d254
4 changed files with 13 additions and 10 deletions
7
2023/day1/day1.2.sh
Normal file
7
2023/day1/day1.2.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
awk -f day1.2.awk $1 | tr -d a-z | grep -o '^.' > first
|
||||
rev $1 | awk -f day1.2.rev.awk | rev | tr -d a-z | grep -o '.$' > last
|
||||
|
||||
paste -d '\0' first last | \
|
||||
awk 'BEGIN { sum = 0 } { sum += $0 } END { print sum }'
|
|
@ -1,6 +0,0 @@
|
|||
#!/bin/zsh
|
||||
|
||||
paste -d '\0' \
|
||||
<(awk -f day1.2.awk $1 | tr -d a-z | rg -o '^.') \
|
||||
<(rev $1 | awk -f day1.2.rev.awk | rev | tr -d a-z | rg -o '.$') | \
|
||||
awk 'BEGIN { sum = 0 } { sum += $0 } END { print sum }'
|
6
2023/day1/day1.sh
Normal file
6
2023/day1/day1.sh
Normal file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
tr -d a-z < $1 | grep -o '^.' > first
|
||||
tr -d a-z < $1 | grep -o '.$' > last
|
||||
paste -d '\0' first last | \
|
||||
awk 'BEGIN { sum = 0 } { sum += $0 } END { print sum }'
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/zsh
|
||||
|
||||
paste -d '\0' <(tr -d a-z < $1 | rg -o ^.) <(tr -d a-z < $1 | rg -o .$) | \
|
||||
awk 'BEGIN { sum = 0 } { sum += $0 } END { print sum }'
|
Loading…
Reference in a new issue