|
| HI All,
I am trying to write a php script for packet accounting for cisco router. I
have a text file with 1000's of lines, similar to this (the text file will
be updated every minute)
111.10.10.10***24.130.162. 182******************49****************3
360
The *'s are spaces in the file. The amount of spaces in between characters
might also vary, for example if an ip address is longer it might look like:
111.10.10.111**211.130.162. 182*****************49****************33
60
What I need done is to "swop" the IP addresses around and then write the
entire line back to a text file, go to next line in source file swop the ip
address position, write to output file and then proceed to next.
Eg
111.10.10.10***24.130.162. 182******************49****************3
360
becomes
24.130.162.182***111.10.10. 10******************49****************33
60
What will be ideal is that once the script has fully processed all the lines
in the source file - that the file be emptied - or the lines can be erased
from the source file as the processing on that line has been complete and
written to output file.
Thanx in advance
Tony
|
|