Click here to Skip to main content
15,435,841 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i need some help in my project a build application in java that read config files from Linux system and i wont to show some value from this files like this

//the code in config file
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.128 192.168.1.254;
option subnet-mask              255.255.255.0;
option broadcast-address        192.168.1.255;#commnet here
....
}


sow in the application it should be print something like that

network 1 : 192.168.1.0/24
  range : from 192.168.1.128 to 192.168.1.254
  mask : 255.255.255.0
  broadcast : 192.168.1.255


so i need to read the value from specified args like "option subnet-mask" to the end of the line is ";" and return just the value "255.255.255.0". and if there comment "#" don't do anything just go to next line. and for each configuration is start from "{" and end at "}". so when is cam to "}" is should be stopped. and go for the next network if there. thanks for helping
Posted

1 solution

 
Share this answer
 
Comments
Marwan Jabbour 4-Nov-15 11:44am    
con you give some code example ? and thanks
Richard MacCutchan 4-Nov-15 11:58am    
Follow those links and you will find lots of sample code, complete with detailed explanations.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900