I would like to sort all the <dict> … </dict> entries in a .plist file at a 
certain level in a plist/xml file.


basically, the file is the Extension.plist in $HOME/Library/Safari/Extensions, 
and I want to sort all the dict entries that are under the key "Installed 
Extension" according to the contents of the string after the key "Archived File 
Name"

here is an example:

        <key>Installed Extensions</key>
        <array>
                <dict>
                        <key>Archive File Name</key>
                        <string>FaceBlock-1.safariextz</string>
                        <key>Bundle Directory Name</key>
                        <string>FaceBlock-1.safariextension</string>
                        <key>Enabled</key>
                        <true/>
                </dict>
                <dict>
                        <key>Archive File Name</key>
                        <string>Validate.safariextz</string>
                        <key>Bundle Directory Name</key>
                        <string>Validate.safariextension</string>
                        <key>Enabled</key>
                        <true/>
                </dict>
                <dict>
                        <key>Archive File Name</key>
                        <string>AdBlock-1.safariextz</string>
                        <key>Bundle Directory Name</key>
                        <string>AdBlock-1.safariextension</string>
                        <key>Enabled</key>
                        <true/>
                </dict>


and it should be:

        <key>Installed Extensions</key>
        <array>
                <dict>
                        <key>Archive File Name</key>
                        <string>AdBlock-1.safariextz</string>
                        <key>Bundle Directory Name</key>
                        <string>AdBlock-1.safariextension</string>
                        <key>Enabled</key>
                        <true/>
                </dict>
                <dict>
                        <key>Archive File Name</key>
                        <string>FaceBlock-1.safariextz</string>
                        <key>Bundle Directory Name</key>
                        <string>FaceBlock-1.safariextension</string>
                        <key>Enabled</key>
                        <true/>
                </dict>
                <dict>
                        <key>Archive File Name</key>
                        <string>Validate.safariextz</string>
                        <key>Bundle Directory Name</key>
                        <string>Validate.safariextension</string>
                        <key>Enabled</key>
                        <true/>
                </dict>

Of course, there are a lot of keys, so I want to automate this.

The dict declarations to sort are all 2 tabs deep in the file.

Oh, it might be nice if I could also then sort on the Enabled key to put all 
the entries with <false/> at the end?

I'm thinking a text-factory could do this?

-- 
7-Up? What happened to Ups 1-6?

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.

Reply via email to