aboutsummaryrefslogtreecommitdiff
path: root/challenge-110/abigail/awk/ch-1.awk
blob: f3b7780f044b289e93a98bae5d458496ae9adf91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/awk

#
# See ../README.md
#

#
# Run as: awk -f ch-1.awk < input-file
#

{
    line = $0;
    gsub (/ */, "", line)                 # Remove spaces
    sub (/^\+/, "00", line)               # Replace leading + with 00
    sub (/^\([0-9]{2}\)/, "0000", line)   # Replace leading (NN) with 0000
}

match (line, /^[0-9]{14}$/) {             # Match exactly 14 digits
    print
}