On Thu, 31 Oct 2024 17:11:44 -0000 (UTC), Jim Henderson wrote: > On Thu, 31 Oct 2024 06:00:31 -0000 (UTC), Duncan wrote: > >> Strong second on search/replace for this sort of thing. Probably faster >> than a GUI would be for it anyway, and arguably more dependable, given >> the low usage and therefore low practical level of testing such a >> bulk-edit special-purpose pan function would likely get. =:^) > > One thing that I noticed as I was looking at this is that the group- > preferences.xml file isn't actually a well-formed XML document. I was > looking for a way to do an XPath-based search and replace (I'm familiar > with using such a tool in the OxygenXML Editor, which is non-free), and > found qxmledit as an alternative, but it refuses to open the file > because it doesn't have a root element. > > So it's XML-ish, but missing the top-most element makes it not a > properly structured XML file. > > That change might be an easier one to make in order for it to be able to > be edited with a smart XML editor that can more easily search and > replace based on the document structure rather than just a simple text > search & replace. > > It seems that the group-preferences.xml file is the only file that > doesn't have a root document.
I just tried an experiment around this with qxmledit, and it seems to have worked OK. Working from a copy of group-preferences.xml, I added a "group- preferences" document root to the file, then opened it in qxmledit. (I also had one entry with a weird encoding that I had to fix prior to opening it, but qxmledit gave me a warning with the line number so I could fix it.) Searching by xpath (for example, I used "/group-preferences/group[starts- with(@name,'novell')]" as the xpath expression) to select all groups with a name that starts with "novell". In my case, I wanted to delete them, so I selected the option to bookmark the selection, and then just deleted the bookmarked items. You can then just use regular text search/replace to search for the posting profile names you want to replace and replace that way. With the number of groups you're dealing with having to remove, I would recommend using some tool that accepts xpath search queries and that can delete entries based on that. 'jq' may be able to do this as well from a command-line if you prefer that. Afterwards, I removed the document root element, saved the original file (just in case), and renamed the temporary file back to the original name. -- Jim Henderson Please keep on-topic replies on the list so everyone benefits _______________________________________________ Pan-users mailing list Pan-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/pan-users