I have a file with data in a certain layout. Each line contains an IP address which I have to extract it and compare it in to something else in C++.
One line looks like this:
t 0.00057 /NodeList/0/DeviceList/0/$ns3::WifiNetDevice/Phy/State/Tx ns3::WifiMacHeader (DATA ToDS=0, FromDS=0, MoreFrag=0, Retry=0, MoreData=0 Duration/ID=0usDA=ff:ff:ff:ff:ff:ff, SA=00:00:00:00:00:01, BSSID=00:00:00:00:00:01, FragNumber=0, SeqNumber=0) ns3::LlcSnapHeader (type 0x800) ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 0 protocol 17 offset (bytes) 0 flags [none] length: 228 10.1.1.1 > 10.1.1.255) ns3::UdpHeader (length: 208 49153 > 80) Payload (size=200) ns3::WifiMacTrailer ()
The IP address which I have to extract is 10.1.1.1.
There are 10,000 lines like this in the file.
t 0.00057 /NodeList/0/DeviceList/0/$ns3::WifiNetDevice/Phy/State/Tx ns3::WifiMacHeader (DATA ToDS=0, FromDS=0, MoreFrag=0, Retry=0, MoreData=0 Duration/ID=0usDA=ff:ff:ff:ff:ff:ff, SA=00:00:00:00:00:01, BSSID=00:00:00:00:00:01, FragNumber=0, SeqNumber=0) ns3::LlcSnapHeader (type 0x800) ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 0 protocol 17 offset (bytes) 0 flags [none] length: 228 10.1.1.1 > 10.1.1.255) ns3::UdpHeader (length: 208 49153 > 80) Payload (size=200) ns3::WifiMacTrailer () r 0.00287433 /NodeList/2/DeviceList/0/$ns3::WifiNetDevice/Phy/State/RxOk ns3::WifiMacHeader (DATA ToDS=0, FromDS=0, MoreFrag=0, Retry=0, MoreData=0 Duration/ID=0usDA=ff:ff:ff:ff:ff:ff, SA=00:00:00:00:00:01, BSSID=00:00:00:00:00:01, FragNumber=0, SeqNumber=0) ns3::LlcSnapHeader (type 0x800) ns3::Ipv4Header (tos 0x0 DSCP Default ECN Not-ECT ttl 64 id 0 protocol 17 offset (bytes) 0 flags [none] length: 228 10.1.1.1 > 10.1.1.255) ns3::UdpHeader (length: 208 49153 > 80) Payload (size=200) ns3::WifiMacTrailer ()
How can I get these IPs? Can anyone help me with the code?