19 lines
563 B
Awk
19 lines
563 B
Awk
|
{
|
||
|
d1 = "";
|
||
|
d2 = "";
|
||
|
if (match($0, "one|two|three|four|five|six|seven|eight|nine|[0-9]")) { d1 = substr($0,RSTART,RLENGTH) }
|
||
|
for (i = length($0); i > 0; i--) {
|
||
|
s = substr($0, i);
|
||
|
if (match(s, "one|two|three|four|five|six|seven|eight|nine|[0-9]")) { d2 = substr(s,RSTART,RLENGTH); break; }
|
||
|
}
|
||
|
n = d1 d2;
|
||
|
print n;
|
||
|
gsub("one","1",n); gsub("two","2",n); gsub("three","3",n);
|
||
|
gsub("four","4",n); gsub("five","5",n); gsub("six","6",n);
|
||
|
gsub("seven","7",n); gsub("eight","8",n); gsub("nine","9",n);
|
||
|
T += n;
|
||
|
print $0, n;
|
||
|
}
|
||
|
#{ print $0 }
|
||
|
END { print T }
|