mercredi 4 novembre 2015

read linux config files using java

I need some help in my project a build application in Java that reads config files from a Linux system. I want to show some value from these files like this:

//the code in config file
subnet netmask {
option subnet-mask    ;
option broadcast-address;#comment here

In the application, it should be print something like this:

  network 1 :
  range : from to
  mask :
  broadcast :

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 "". and if there is a comment "#", don't do anything just go to next line. Each configuration starts from "{" and ends at "}". So when it comes to "}" it should stop and go for the next network if there.

Aucun commentaire:

Enregistrer un commentaire