Sorry if this is something really simple …
I’m trying to use the AWK command to retrieve only the City and State from the whitepages website for an entered phone number. This is the command that works:
set cityState to do shell script "curl -A \"Mozilla/4.0\" -s " & whitePage & phoneNum & " | awk '/Location: / {print $7, $8, $9}' | cut -f 1 -d '<' "
(thanks to Stefan, Mark Hunte and Bruce Phillips for getting me that far)
but the problem is, this only really works for certain types of phone numbers. in this example, only ph#408-886-9012 works.
I’ve figured out this has to do with the print $ part of the script. Here’s the actual html for the reverse phone look up page for that phone number:
Type: Land LineProvider: Mpower Networks ServicesLocation: San Jose, CA
So what’s happening when I try looking up other phone numbers that are cell phones, or have a different service provider, all that information before the “Location” part of the code changes.
My question is, is there another type of command I can be doing with AWK that only returns the specfic information after the word “Location:”, rather than a $ command specifying the “column” data to return?
As is probably obvious, I’m a noob to shell commands and Applescripts in general. I really think I can use awk commands for a lot of different stuff, but so far I’m having some trouble learning about it off the internet. If anyone has any good sites or resources for a beginner, please share. I really want to start learning this on my own so I don’t keep using the forums as a crutch.