From: kazaam Date: 2007-08-26T20:15:05+09:00 Subject: Finding one certain line in a file is easy but how to look for headlines and something just under this certain headline? Hi, I'm writing a little script for installing ati-drivers on linux machines but I have a little problem. I need to change the /etc/X11/xorg.conf file for this. This file is built like this (just a cut-out): Section "InputDevice" Identifier "Generic Keyboard" Driver "kbd" Option "CoreKeyboard" Option "XkbRules" "xorg" Option "XkbModel" "pc105" Option "XkbLayout" "de" Option "XkbOptions" "lv3:ralt_switch" EndSection Section "Device" Identifier "Standardgrafikkarte" Driver "ati" BusID "PCI:1:0:0" EndSection Section "Monitor" Identifier "Standardbildschirm" Option "DPMS" HorizSync 28-64 VertRefresh 43-60 EndSection Section "DRI" Mode 0666 EndSection Section "Extensions" Option "Composite" "Disable" EndSection Now I need to change the driver value within the Section "Device" from ati|vesa|radeon|nomatterwhat... to fglrx, but how to find it? E.g. IO.foreach('/etc/X11/xorg.conf') { |line| puts line if line =~ /^Section "Device"/ } finds me the correct section but how to "navigate" now in it? Is iteration at all the answer to this problem? greets -- kazaam