Modifying plist key

OK, so I have this plist here:

[code]<?xml version="1.0" encoding="UTF-8"?>

PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0) @0,compatible NVDA,NVMac @0,device_type display @0,name NVDA,Display-A @1,compatible NVDA,NVMac @1,device_type display @1,name NVDA,Display-B @2,#adress-cells 0x01000000 @2,#size-cells 0x00000000 @2,compatible NVDA,sensor-parent @2,device_type NVDA,gpu-diode @2,hwctrl-params-version 0x02000000 @2,hwsensor-params-version 0x02000000 @2,name sensor-parent @2,reg 0x02000000 NVCAP BAAAAAAAAwAMAAAAAAAABwAAAAA= NVPM AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== device_type NVDA,GeForce model NVIDIA GeForce 7600 GS EFI name NVDA,Parent rom-revision 0x32323033 [/code] Basically, I need a AppleScript that can change the name of the "PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)" key at the top to "PciRoot(2x0)/Pci(0x1,0x0)/Pci(0x0,0x1)"

Is this a text-based plist, or a binary plist?

More and more of the system is moving to binary-based plists, so you should check that first, but if it’s a plain text plist I’d go for a shell-based approach, probably via sed:

do shell script "sed -i -e 's.PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0).PciRoot(2x0)/Pci(0x1,0x0)/Pci(0x0,0x1).' /path/to/the.plist"

Thanks, that did it. It was a text based plist :slight_smile: