day 01
This commit is contained in:
commit
0ff78355b1
|
@ -0,0 +1,22 @@
|
|||
BEGIN { FS=""; OFS=""; s = 0 }
|
||||
|
||||
# since this is destructive, p1 and p2 are separate
|
||||
# to use p2 add -v p=2
|
||||
p == 2 {
|
||||
gsub(/one/, "on1ne");
|
||||
gsub(/two/, "tw2wo");
|
||||
gsub(/three/, "thre3hree");
|
||||
gsub(/four/, "fou4our");
|
||||
gsub(/five/, "fiv5ive");
|
||||
gsub(/six/, "si6ix");
|
||||
gsub(/seven/, "seve7even");
|
||||
gsub(/eight/, "eigh8ight");
|
||||
gsub(/nine/, "nin9ine");
|
||||
}
|
||||
|
||||
{
|
||||
gsub(/[^0-9]/, "")
|
||||
s += $1$NF
|
||||
}
|
||||
|
||||
END { print s }
|
Loading…
Reference in New Issue