• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Router's IP address - how to grep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Router's IP address - how to grep


  • Subject: Re: Router's IP address - how to grep
  • From: Joe <email@hidden>
  • Date: Thu, 15 May 2008 13:54:08 -0700

Mark J. Reed wrote:
>If you're on Leopard, you can use the -o option to grep to return only
>the portion of the line that matches, but that means the pattern has
>to include everything you want to see.  Something like this may work:
>
>do shell script "/usr/local/bin/lynx -dump " & quoted form of theURL &
>" | grep -o 'Internet
>Address:[^0-9]*[0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*' "


Thanks Mark. Your script works as written and returns:

"Internet Address: 95.88.232.31"

I want to get only the numeric portion so I tried removing "Internet Address:" from the pattern. However that shows me the whole line.

"   o Internet Address: 95.88.232.31"

I know I could revert to AppleScript at this point and use 'offset of' but can I get only the numeric part with the grep command?

Joe
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Router's IP address - how to grep (From: Joe <email@hidden>)
 >Re: Router's IP address - how to grep (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: Router's IP address - how to grep
  • Next by Date: Re: Router's IP address - how to grep
  • Previous by thread: Re: Router's IP address - how to grep
  • Next by thread: Re: Router's IP address - how to grep
  • Index(es):
    • Date
    • Thread