Linux.com

mgd

mgd

  • Linux.com Member
  • Posts: 2
  • Member Since: 05 Mar 10
  • Last Logged In: 03 Jan 13

Latest Posts

Posted by
Topic
Post Preview
Posted
  • mgd
    RE: using wget, checkip.dyndns.org, and sed
    Hi, Karma The "cut" and "awk" commands used in your examples produced slightly different results, but each example was most helpful in illustrating the basics of these two commands. I now have two command options for filtering output/text. Cut produces: Current IP Address: 208.106.8.22 AWK produces: 208.106.8.22 Thank you kindly,
    Link to this post 26 Feb 11

    Hi, Karma

    The "cut" and "awk" commands used in your examples produced slightly different results, but each example was most helpful in illustrating the basics of these two commands. I now have two command options for filtering output/text.

    Cut produces: Current IP Address: 208.106.8.22

    AWK produces: 208.106.8.22

    Thank you kindly,

  • mgd
    using wget, checkip.dyndns.org, and sed
    I am trying to get my external Ip using cygwin on a Windows 7 box. I am almost there but I am having an issue with the sed substitution syntax. As you see, I am getting the IP, but I don't want the part of the output. C:\>wget -q http://checkip.dyndns.org -O index1.html && sed "s/.*:\(.*\)<.*/\1/" index1.html 208.106.78.22 Without the -q switch the output is: Current IP CheckCurrent IP Address: 206.108.78.2 How do I have to change the sed command? Instead of creating the index1.html file, I also tried unsuccessfully to use pipe and grep, but failed to get that working properly. Alternative approaches would also be appreciated, but I would like to know what I am doing wrong with the sed commands. I have tried many different variations, but just can't seem to get just the IP address. Thank you, mgd
    Link to this post 24 Feb 11

    I am trying to get my external Ip using cygwin on a Windows 7 box. I am almost there but I am having an issue with the sed substitution syntax. As you see, I am getting the IP, but I don't want the </body> part of the output.

    C:\>wget -q http://checkip.dyndns.org -O index1.html && sed "s/.*:\(.*\)<.*/\1/" index1.html
    208.106.78.22</body>

    Without the -q switch the output is:

    <html><head><title>Current IP Check</title></head><body>Current IP Address: 206.108.78.2</body></html>

    How do I have to change the sed command? Instead of creating the index1.html file, I also tried unsuccessfully to use pipe and grep, but failed to get that working properly. Alternative approaches would also be appreciated, but I would like to know what I am doing wrong with the sed commands. I have tried many different variations, but just can't seem to get just the IP address.

    Thank you,
    mgd

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board