1 of 2
Forest
  • 143
  • 3

Recursively grouping symlinks by original file

Pardon me, but I don't actually know where to begin with this - I will update if I get further. Sorry. Basically, I've got a list in a text file similar in structure to the following:

symlink("toolbox", "/system/bin/schedtop");
symlink("toolbox", "/system/bin/sendevent");
symlink("toolbox", "/system/bin/setconsole");
symlink("toolbox", "/system/bin/setenforce");
symlink("toolbox", "/system/bin/setprop");
symlink("toolbox", "/system/bin/setsebool");
symlink("mksh", "/system/bin/sh");

What I want to do is change them, using a Bash script, to be like the following:

symlink("toolbox", "/system/bin/schedtop", "/system/bin/sendevent", "/system/bin/setconsole", "/system/bin/setenforce", "/system/bin/setprop", "/system/bin/setsebool")
symlink("mksh", "/system/bin/sh");

This means grouping the lines and merging them based on the original file, in this case, toolbox.

Currently I'm just sorting the file by name, but that's not satisfactory, of course! Can anyone point me in the right direction?

Thanks!

Forest
  • 143
  • 3