Help me sed or awk this figity config file please!
by arifd86 from LinuxQuestions.org on (#5CWXQ)
So if I want to programmatically add an app to the quicklaunch of lxqt-panel, they've made it somewhat frustratingly difficult to do so.
Among the config file is this relevant section
Code:[quicklaunch]
alignment=Left
apps\1\desktop=/usr/share/applications/pcmanfm-qt.desktop
apps\2\desktop=/usr/share/applications/pavucontrol-qt.desktop
apps\size=2
type=quicklaunchI want some sed or awk code that will find this line 'apps\size=' followed by an unkwnown number, which has to appear after a line containing '[quicklaunch]' but before any empty lines. the number must be incremented by 1 and stored into a variable so that we can then inject into the line above our desired .desktop file.
So that in this concrete example, the result will look like this:
Code:[quicklaunch]
alignment=Left
apps\1\desktop=/usr/share/applications/pcmanfm-qt.desktop
apps\2\desktop=/usr/share/applications/pavucontrol-qt.desktop
apps\3\desktop=/path/to/app.desktop
apps\size=3
type=quicklaunchThis is rather advanced awk manipulation for me, so I appreciate your help.
Thanks!


Among the config file is this relevant section
Code:[quicklaunch]
alignment=Left
apps\1\desktop=/usr/share/applications/pcmanfm-qt.desktop
apps\2\desktop=/usr/share/applications/pavucontrol-qt.desktop
apps\size=2
type=quicklaunchI want some sed or awk code that will find this line 'apps\size=' followed by an unkwnown number, which has to appear after a line containing '[quicklaunch]' but before any empty lines. the number must be incremented by 1 and stored into a variable so that we can then inject into the line above our desired .desktop file.
So that in this concrete example, the result will look like this:
Code:[quicklaunch]
alignment=Left
apps\1\desktop=/usr/share/applications/pcmanfm-qt.desktop
apps\2\desktop=/usr/share/applications/pavucontrol-qt.desktop
apps\3\desktop=/path/to/app.desktop
apps\size=3
type=quicklaunchThis is rather advanced awk manipulation for me, so I appreciate your help.
Thanks!