getting IP address of router
jim ruxton
cinetron-uEvt2TsIf2EsA/PxXw9srA at public.gmane.org
Sun Feb 13 17:56:48 UTC 2005
> >> echo "abc IP: 1.2.3.4</title>"|sed 's/.* IP: \(.*\)<\/title>.*/\1/'
> >>
> > Yup this works??
>
> Therefore whatever that site returns does not match the regexp above.
> Fix the regexp. I suggest that a better regexp will be:
>
> 's/IP:[ \t]*\(.*\)<\/title>.*/\1/'
>
> (and this time pipe the output of curl into it). If it still does not
> work, *do* look at the output of curl character by character, f.ex.
> using od -Ax -tax1
Thanks Peter. Strange thing is that the same script works for other
people. It must be shell or version dependant?
# curl -s -o - http://www.myip.dk | sed 's%.* IP: \(.*\)</title>.*%\1%'
>
> good luck,
> Peter
> --
> The Toronto Linux Users Group. Meetings: http://tlug.ss.org
> TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
>
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list