Larry Lounge from Los Angeles has phone number 213-555-5432. My social security number is 555-55-5555. Larry's work number in the valley is (818) 555-1234, pager (818)555-9876. Bill from Orlando is at 555-5644. His account # is 323x555-1407. Charlie Chan from Chicago is at (312)555-1212. |
# THIS IS phones.awk BEGIN {pat="(\\({0,1}[0-9]{3}\\){0,1} {0,1}-{0,1} {0,1}){0,1}[0-9]{3}-[0-9]{4}"} { line=$0; match(line,pat) while(RLENGTH > 0) { print substr(line, RSTART, RLENGTH) line=substr(line, RSTART+RLENGTH) match(line,pat) } } |
$ awk --posix -f phones.awk phones.txt |
|
Copyright (C) 2001 by Steve Litt, you can freely distribute
unmodified copies if this copyright notice and disclaimer are intact.
This material originally appeared on Troubleshooters.Com.
This presentation has no warrantee, express or implied, including,
but not limited to, the implied warranties of merchantability and fitness
for a particular purpose. The entire risk as to the quality and performance
of the presentation is with you. Neither the author nor those who show
the slideshow are responsible for any damage caused by errors, omissions,
or anything else relating to this slideshow.
|