shell-script-pt
[Top][All Lists]
Advanced

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

Alterar xorg.conf com SED


From: Andrea VB
Subject: Alterar xorg.conf com SED
Date: Fri, 13 Apr 2007 13:25:16 -0300

Amigos, preciso alterar o xorg.conf com um script, e pensei em fazer
isso usando o sed.
O problema é que o xorg.conf pode não ser o mesmo para todo mundo.

         sed -i '/padrao/anovalinha/' xorg.conf
Esse comando acrescenta uma linha com o texto "novalinha" após a linha
em que existe a palavra "padrao". No meu caso, "novalinha" seria:
[[      InputDevice    "Synaptics Touchpad" ]]

Segue um exemplo de como seriam a entrada e a saída...

O problema é como encontrar a linha "padrao"... Uma idéia que pensei,
mas não consegui implementar, seria escrever "novalinha" umas três
linhas após [[Section "ServerLayout"]]
Alguma luz??

Abraço e obrigada

[velhoxorg]
Section "ServerLayout"
        Identifier     "Default Layout"
        Screen      0  "aticonfig-Screen[0]" 0 0
        InputDevice    "Generic Keyboard"
        InputDevice    "Configured Mouse"
        InputDevice    "stylus" "SendCoreEvents"
        InputDevice    "cursor" "SendCoreEvents"
        InputDevice    "eraser" "SendCoreEvents"
EndSection
[/velhoxorg]

[novoxorg]
Section "ServerLayout"
        Identifier     "Default Layout"
        Screen      0  "aticonfig-Screen[0]" 0 0
        InputDevice    "Generic Keyboard"
        InputDevice    "Configured Mouse"
        InputDevice    "stylus" "SendCoreEvents"
        InputDevice    "cursor" "SendCoreEvents"
        InputDevice    "eraser" "SendCoreEvents"
        InputDevice    "Synaptics Touchpad"
EndSection
[/novoxorg]

reply via email to

[Prev in Thread] Current Thread [Next in Thread]