Last active
April 5, 2025 21:39
-
-
Save fabiolimace/2f3cf066eb3ec3c61b70eb93869c8646 to your computer and use it in GitHub Desktop.
Join numeric tokens with AWK. Moved to https://github.com/fabiolimace/awk-tools
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function join_numbers( i, n, x) { | |
while (match($0, /[ ][0-9,.()-]+[ ][0-9,.()-]+[ ]?/)) { | |
i = RSTART; | |
n = RLENGTH; | |
x = substr($0, i, n); | |
gsub(" ", "", x); | |
$0 = substr($0, 0, i-1) " " x " " substr($0, i+n) | |
} | |
} | |
{ | |
print; | |
join_numbers(); | |
print; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Meu telefone é 85 988887777. | |
Meu telefone é (85) 98888-7777. | |
Na guerra morreram 1 500 soldados. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example: