I want to delete some lines containing specific strings from two configuration files. These files are for docks: Wbar & SimDock. I'm trying to complete my bash scripts but I cannot find an effective method for this.
This is my first file, "$HOME/.wbar":
i: /usr/share/pixmaps/wbar/dock.png
c: wbar --bpress --above-desk --pos top --grow --isize 48 --idist 3 --nanim 4 --falfa 65 --filter 0
t: /usr/share/fonts/truetype/liberation/LiberationMono-Bold/10
i: /usr/share/icons/nuoveXT2/128x128/apps/firefox.png
c: /usr/bin/www-browser
t: Web Browser
i: /usr/share/icons/nuoveXT2/128x128/apps/gthumb.png
c: gpicview
t: Image Viewer
i: /usr/share/icons/nuoveXT2/128x128/devices/media-cdrom-audio.png
c: audacious
t: Audio Player : Audacious
i: /usr/share/icons/nuoveXT2/128x128/apps/text-editor.png
c: medit
t: Text Editor
i: /usr/share/icons/nuoveXT2/128x128/apps/kfm.png
c: xfe
t: File Manager Xfe
i: /usr/share/icons/nuoveXT2/128x128/apps/terminal.png
c: xfce4-terminal
t: Terminal
i: /usr/share/pixmaps/wbar/wbar.png
c: wbar-config
t: Configure Wbar
i: /home/inukaze/dosbox/bchess/bchess.png
c: /home/inukaze/dosbox/bchess/bchess.sh
t: DosBox BattleChess
How can I delete the lines of "Battle Chess" + Last Blank Space? Should I use sed, or another method? I tried the following but it didn't work.
$ sed -i 'i: /home/inukaze/dosbox/bchess/bchess.png/d'
sed: -e expression #1, character 6: unknown order : «u»
I am also trying to modify the following file, "launchers.xml":
<?xml version="1.0" encoding="utf-8"?>
<Program>
<SimDock>
<path>/usr/bin/firefox</path>
<icon>/usr/share/firefox/icons/mozicon128.png</icon>
<description>Firefox web browser</description>
<name>Firefox</name>
</SimDock>
<SimDock>
<path>/home/inukaze/dosbox/bchess/bchess.sh</path>
<icon>/home/inukaze/dosbox/bchess/bchess.png</icon>
<description>Launch The BattleChess MS-D.o.s Game</description>
<name>BattleChess</name>
</SimDock>
</Program>
The problem with this is that every entry is contained within a <SimDock></SimDock>
section, which must also be removed. I would also like to remove the section corresponding to "BattleChess" from this file.
How can I remove the sections from these two files, using sed or another method?