how to parse a string parse with ereg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I've a string where the output of route -n is in for example.

x.x.x.x     0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
192.168.0.0 0.0.0.0         255.255.255.0   U     0      0        0 eth1
0.0.0.0         x.x.x.x     0.0.0.0         UG    0      0        0 ppp0

The regular expression is already working but how can I reduce the
string to have then only 2 lines ?

To explain this I can proof if the first line is set properly.
This is already done.

So I would like now to delete the first line of the string which
includes this data. So I would then have now:

192.168.0.0 0.0.0.0         255.255.255.0   U     0      0        0 eth1
0.0.0.0         x.x.x.x     0.0.0.0         UG    0      0        0 ppp0

Then I could test if the second line is set properly which is
now the first line and so on.

What I need would be a looping possibilty which makes it able
to delete every line which is ok so far and so on. As I don't
know what routing table a person is using there could be 
quite a lot of lines which should be proofed concerning the 
syntax.

-- 
Best Regards, Mark. 
"Hello, I am brand new to meditation, and I have a frustrating habit of falling asleep in class. I don't know how to stop this. When my teacher tells us to relax our bodies and focus on breathing, my body relaxes, but so does my brain."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux