I have a text file containing some IP addresses.
How can I get the IP addresses even if they change places (for example, taking the IP address from the beginning and writing it to the end)
Text example :
"192.168.4.163 - - [22/Dec/2016:22:32:32 +0300] "GET / HTTP/1.1" 200 3279 "-" "w3af.org""
"192.168.4.163 - - [22/Dec/2016:22:32:32 +0300] "GET / HTTP/1.1" 200 3279 "-" "w3af.org""
" - - [22/Dec/2016:22:32:32 +0300] 192.168.4.163 "GET / HTTP/1.1" 200 3279 "-" "w3af.org""
Code part:
ifstream listfile;
listfile.open("log.txt");
ofstream cleanIp;
cleanIp.open("ipAddress.txt");
ifstream readIp;
string ipLine;
readIp.open("ipAddress.txt");
string temp;
while(listfile>>temp) //get just ips
{
cleanIp<<temp<<endl;
listfile>>temp;
getline(listfile, temp);
}