Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can issue a <code>system()</code> command to your operating system:</p> <ul> <li>In Windows you can use <code>ipconfig</code></li> <li>In Linux, use <code>ifconfig</code></li> </ul> <p>For example, on Windows try calling <code>system()</code> with the argument <code>intern=TRUE</code> to return the results to R:</p> <pre><code>x &lt;- system("ipconfig", intern=TRUE) </code></pre> <p>This returns:</p> <pre><code>x [1] "" [2] "Windows IP Configuration" [3] "" [4] "" [5] "Wireless LAN adapter Wireless Network Connection:" [6] "" [7] " Connection-specific DNS Suffix . : tbglondon.local" [8] " Link-local IPv6 Address . . . . . : fe80::c0cb:e470:91c7:abb9%14" [9] " IPv4 Address. . . . . . . . . . . : 10.201.120.184" [10] " Subnet Mask . . . . . . . . . . . : 255.255.255.0" [11] " Default Gateway . . . . . . . . . : 10.201.120.253" [12] "" [13] "Ethernet adapter Local Area Connection:" [14] "" [15] " Connection-specific DNS Suffix . : tbglondon.local" [16] " Link-local IPv6 Address . . . . . : fe80::9d9b:c44c:fd4d:1c77%11" [17] " IPv4 Address. . . . . . . . . . . : 10.201.120.157" [18] " Subnet Mask . . . . . . . . . . . : 255.255.255.0" [19] " Default Gateway . . . . . . . . . : 10.201.120.253" [20] "" [21] "Tunnel adapter Local Area Connection* 13:" [22] "" [23] " Media State . . . . . . . . . . . : Media disconnected" [24] " Connection-specific DNS Suffix . : " [25] "" [26] "Tunnel adapter isatap.tbglondon.local:" [27] "" [28] " Media State . . . . . . . . . . . : Media disconnected" [29] " Connection-specific DNS Suffix . : tbglondon.local" [30] "" [31] "Tunnel adapter Teredo Tunneling Pseudo-Interface:" [32] "" [33] " Media State . . . . . . . . . . . : Media disconnected" [34] " Connection-specific DNS Suffix . : " </code></pre> <p>Now you can use <code>grep</code> to find the lines with <code>IPv4</code>:</p> <pre><code>x[grep("IPv4", x)] [1] " IPv4 Address. . . . . . . . . . . : 10.201.120.184" [2] " IPv4 Address. . . . . . . . . . . : 10.201.120.157" </code></pre> <p>And to extract just the ip address:</p> <pre><code>z &lt;- x[grep("IPv4", x)] gsub(".*? ([[:digit:]])", "\\1", z) "10.201.120.184" "10.201.120.157" </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload