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

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

Re: [shell-script] Alterar xorg.conf com SED


From: edjunior
Subject: Re: [shell-script] Alterar xorg.conf com SED
Date: Fri, 13 Apr 2007 14:28:58 -0300

hey,

creio que algo do tipo te ajude. Eu selecionei a seção "ServerLayout"
e inclui sua linha nova antes do final ("EndSection"):

sed  '/Section\ \"ServerLayout\"/,/EndSection/
s/EndSection/\tInputDevice\t\"Synaptics\ Touchpad\"\nEndSection/'
xorg.conf

hasta!

jr.

On 4/13/07, Andrea VB <address@hidden> wrote:
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]


---------------------------------------------------------------------
Esta lista não admite a abordagem de outras liguagens de programação, como 
perl, C etc. Quem insistir em não seguir esta regra será moderado sem prévio 
aviso.
---------------------------------------------------------------------
Sair da lista: address@hidden
---------------------------------------------------------------------
Esta lista é moderada de acordo com o previsto em 
http://www.listas-discussao.cjb.net
---------------------------------------------------------------------
Servidor Newsgroup da lista: news.gmane.org
Grupo: gmane.org.user-groups.programming.shell.brazil


Links do Yahoo! Grupos





reply via email to

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