The original that the external network IP acquisition was through the swz8.com website extraction
Now this website has been closed. The younger brother found its IP acquisition page from ip138
But I don't know much about text processing. Please help improve it
@echo off
title Get local intranet and external network IP
if exist ip2city.asp del ip2city.asp
if exist ip.txt del ip.txt
if exist 1.txt del 1.txt
if exist 2.txt del 2.txt
wget http://www.ip138.com/ip2city.asp
ren ip2city.asp 1.txt
At this time, the content of 1.txt is
The following is to extract with SED
sed -r "s/(+\.+\.+\.+).*/\n\1/;s/^.*\n//" 1.txt >2.txt
for /f %%i in (2.txt) do set i=%%i
echo %i% >ip.txt
start ip.txt
The content of IP.txt is
I'm a novice. Please help the master to simplify and improve, and remove the space followed by carriage return in IP.TXT
Now this website has been closed. The younger brother found its IP acquisition page from ip138
But I don't know much about text processing. Please help improve it
@echo off
title Get local intranet and external network IP
if exist ip2city.asp del ip2city.asp
if exist ip.txt del ip.txt
if exist 1.txt del 1.txt
if exist 2.txt del 2.txt
wget http://www.ip138.com/ip2city.asp
ren ip2city.asp 1.txt
At this time, the content of 1.txt is
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title> Your IP address </title>
</head>
<body style="margin:0px"><center>Your IP address is: From: Zhuzhou City, Hunan Province Telecom</center></body></html>The following is to extract with SED
sed -r "s/(+\.+\.+\.+).*/\n\1/;s/^.*\n//" 1.txt >2.txt
for /f %%i in (2.txt) do set i=%%i
echo %i% >ip.txt
start ip.txt
The content of IP.txt is
1.1.1.1 space followed by carriage returnI'm a novice. Please help the master to simplify and improve, and remove the space followed by carriage return in IP.TXT


