Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I need to write script in Python to read/write /etc/network/interfaces file. It is not parse-able with builtin module ConfigParser because there are no sections.

Is there any parser for such files? Or maybe Python module to manage network configuration?

Or maybe there are other ways to read/change network interfaces settings?!

share|improve this question
    
If I look at the file on my pc, it looks like a simple text file with all data on a seperate line. what keeps you from writing your own parser/writer? –  Timo Jan 10 '12 at 16:10
    
Yes. I had to write my own parser. But it was not easy task, because it's structure may be complex... –  marcinpz Feb 13 '12 at 10:43
1  
You should open source it! –  Brian Cline Apr 19 '13 at 7:15
add comment

1 Answer

Here you can find a Awk script that can parse and modify /etc/network/interface, good starting point.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.