#!/bin/sh
if ! kdialog --warningcontinuecancel "<qt><b>DON'T RUN THIS MULTIPLE TIMES</b><br>This is a dumb script<br>If you run it multiple times, it wil apply multiple changes,<br>resulting in unwanted settings<br><br>This does not mean you're currently doing wrong.<br>It's just to make sure you know what you're doing ;)</qt>" --title "General Warning"
then
exit 0
fi
if ! cd ~/.baghira
then
kdialog --error "<qt>Predefinition directory does not exist<br><b>No settings will be changed</b></qt>"
exit 1
fi
cd ~/.baghira
for name in *
do echo -e "$(( $(grep -n "" "$name" | grep "1:" | cut -d: -f2) + 1 ))\n$(grep -n "" "$name" | grep "2:" | cut -d: -f2)" > "$name"
done