[Klug-general] auto-delete menu entries as part of a bash script
Sharon Kimble
boudiccas at talktalk.net
Mon Nov 25 18:11:50 UTC 2013
On Mon, 25 Nov 2013 17:22:46 +0000
James Morris <jwm.art.net at gmail.com> wrote:
Thanks for this James, this is what I tried.
> You can use sed with a regular expression:
> sed '\|\[exec[]]\s[(]\(.*\)[)]\s[{]/usr/lib/xscreensaver/\1
> -root[}]|d' path/to/menufile
sed '\|\[exec[]]\s[(]\(.*\)[)]\s[{]/usr/lib/xscreensaver/\1
> -root[}]|d' /home/boudiccas/.fluxbox/menu
sed: -e expression #1, char 54: unterminated address regex
And that is what it replied.
Thanks
Sharon.
>
> the above command output the menufile to stdout minus matching lines,
> it assumes no variation in spaces between the { and } characters from
> the example you showed.
>
> once you have confirmed that it works and is not removing lines which
> you do not wish removed, pass the -i option for it to edit the file
> proper.
>
> i've tested it in debian, using the following file:
>
> ----8<--------8<--------8<--------8<--------8<----
>
> [begin] (Fluxbox 1.3.5)
> [encoding] {UTF-8}
> [exec] (xterm) {xterm}
> [exec] (firefox) {firefox}
> [exec] (Run) {fbrun}
> [submenu] (Terminals)
> [exec] (xterm) {xterm}
> [end]
>
>
> [exec] (foobar) {/usr/lib/xscreensaver/foobar -root}
> [exec] (foobar1) {/usr/lib/xscreensaver/foobar1 -root}
> [exec] (foobar) { /usr/lib/xscreensaver/foobar -root }
> [exec] (fooba3r) {/usr/lib/xscreensaver/fooba3r -root }
> [exec] (bar) {/usr/lib/xscreensaver/bar -root}
> [exec] (barf) {/usr/lib/xscreensaver/barf -root}
>
> ----8<--------8<--------8<--------8<--------8<----
>
> note it won't remove the menu entries with the extra spaces between
> { }.
>
> james.
>
> On 25 November 2013 16:08, Sharon Kimble <boudiccas at talktalk.net>
> wrote:
> >
> > I want to delete menu commands that are in the form of -
> >
> > [exec] (foobar) {/usr/lib/xscreensaver/foobar -root}
> >
> > and there are 50+ commands to be deleted as part of a bash-script.
> > But, how do I do it please? I need some form of commands that I can
> > put into my menu generation script, which will auto-delete them in
> > the future. Can anyone help please?
> >
> > Thanks
> > Sharon.
> > --
> > A taste of linux = http://www.sharons.org.uk
> > efever = http://www.efever.blogspot.com/
> > efever = http://sharon04.livejournal.com/
> > my git repo = https://bitbucket.org/boudiccas/dots
> > Debian testing, Fluxbox 1.3.5, LibreOffice 4.1.3.2
> > Registered Linux user 561944
> >
> > _______________________________________________
> > Kent mailing list
> > Kent at mailman.lug.org.uk
> > https://mailman.lug.org.uk/mailman/listinfo/kent
>
> _______________________________________________
> Kent mailing list
> Kent at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/kent
--
A taste of linux = http://www.sharons.org.uk
efever = http://www.efever.blogspot.com/
efever = http://sharon04.livejournal.com/
my git repo = https://bitbucket.org/boudiccas/dots
Debian testing, Fluxbox 1.3.5, LibreOffice 4.1.3.2
Registered Linux user 561944
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mailman.lug.org.uk/pipermail/kent/attachments/20131125/5f0b5f3e/attachment-0001.pgp>
More information about the Kent
mailing list