Question : sed expression

hi!
Could anybody help to write sed expression to change the lines between
"Keyboard0" and EndSection to lines i specify

e.g.

source

Section "InputDevice"
# Specify which keyboard LEDs can be user-controlled (eg, with xset(1))
#       Option  "Xleds"         "1 2 3"
# To disable the XKEYBOARD extension, uncomment XkbDisable.
#       Option  "XkbDisable"
# To customise the XKB settings to suit your keyboard, modify the
# lines below (which are the defaults).  For example, for a non-U.S.
# keyboard, you will probably want to use:
#       Option  "XkbModel"      "pc102"
# If you have a US Microsoft Natural keyboard, you can use:
#       Option  "XkbModel"      "microsoft"
#
# Then to change the language, change the Layout setting.
# For example, a german layout can be obtained with:
#       Option  "XkbLayout"     "de"
# or:
#       Option  "XkbLayout"     "de"
#       Option  "XkbVariant"    "nodeadkeys"
#
# If you'd like to switch the positions of your capslock and
# control keys, use:
#       Option  "XkbOptions"    "ctrl:swapcaps"
# Or if you just want both to be control, use:
#       Option  "XkbOptions"    "ctrl:nocaps"
#
        Identifier  "Keyboard0"
        Driver      "keyboard"
        Option      "XkbRules" "xfree86"
        Option      "XkbModel" "logicordless"
        Option      "XkbLayout" "us"
EndSection

What i need is :
Section "InputDevice"
     Identifier  "Keyboard0"
       Driver      "keyboard"
       Option      "XkbRules" "xfree86"
       Option      "XkbModel" "pc105"
       Option      "XkbGeometry" "pc"
       Option      "XkbKeycodes" "xfree86"
       Option      "XkbTypes" "default"
       Option      "XkbCompat" "default"
       Option      "XkbLayout" "rulv(basic)"
       Option      "XkbOptions" "grp:caa_tsd"
EndSection

Answer : sed expression

you can just add the lines by replacing   ' Option      "XkbModel" "logicordless ' by the desired lines.

sed "s/^*Option.*XkbModel*logi*$/Option      "XkbModel" "pc105" ENDLINE Option      "XkbGeometry" "pc"ENDLINE       Option      "XkbKeycodes" "xfree86"ENDLINE       Option      "XkbTypes" "default" ENDLINE option      "XkbCompat" "default"  endline     Option      "XkbLayout" "rulv(basic)"endlineOption      "XkbModel" "pc105"/"
now ENDLINE is not actually the word endline it is (CTRL v) +enter   it will create the endofline for you.

       
Random Solutions  
 
programming4us programming4us