<div dir="auto">Hi,<div dir="auto"><br></div><div dir="auto">I think that jq should give you what you need. </div><div dir="auto"><br></div><div dir="auto">jq is like sed for JSON data - you can use it to slice and filter and map and transform structured data with the same ease that sed, awk, grep and friends let you play with text.<br></div><div dir="auto"><br></div><div dir="auto"><a href="https://stedolan.github.io/jq/">https://stedolan.github.io/jq/</a><br></div><div dir="auto"><br></div><div dir="auto">Regards</div><div dir="auto">Toby</div><div dir="auto"><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, 20 Jun 2018, 08:39 David Hodgkinson via Swlug, <<a href="mailto:swlug@mailman.lug.org.uk">swlug@mailman.lug.org.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">That’s a few lines of perl...<br>
<br>
> On 20 Jun 2018, at 03:26, bascule via Swlug <<a href="mailto:swlug@mailman.lug.org.uk" target="_blank" rel="noreferrer">swlug@mailman.lug.org.uk</a>> wrote:<br>
> <br>
> this is a request for help, it's not actually linux related except inasmuch as <br>
> the solution may utilise a linux distro.<br>
> <br>
> i have some json files i wish to edit, their being json files is irrelevant to <br>
> me, i'm not doing json stuff, these files come to me as they are and i need/<br>
> wish to futz with them.<br>
> <br>
> they have objects in them such as:<br>
> <br>
> {<br>
> "ConnectedObjects" : "",<br>
> "ExtraData" : "",<br>
> "FormID" : "004366",<br>
> "FormID_dec" : 184566630,<br>
> "PlotPath01FormID_dec" : 0,<br>
> "PlotPath01Plugin" : "",<br>
> "PlotPath02FormID_dec" : 0,<br>
> "PlotPath02Plugin" : "",<br>
> "PlotPath03FormID_dec" : 0,<br>
> "PlotPath03Plugin" : "",<br>
> "PlotPlanFormID" : "002151",<br>
> "PlotPlanFormID_dec" : 385884497,<br>
> "PlotPlanPlugin" : "SimSettlements_AddOnPack_Defences_Brae.esp",<br>
> "PlotStage" : 0,<br>
> "PlotVIPStoryFormID_dec" : 0,<br>
> "PlotVIPStoryPlugin" : "",<br>
> "RemoveHavok" : 0,<br>
> "Scale" : 1.0,<br>
> "idx" : 1471,<br>
> "isActor" : 0,<br>
> "isAssignable" : 1,<br>
> "isCreated" : 1,<br>
> "isFarmAnimal" : 0,<br>
> "isFood" : 0,<br>
> "isGenerator" : 0,<br>
> "isPowered" : 1,<br>
> "isTamedCreature" : 0,<br>
> "isTurret" : 0,<br>
> "isWater" : 0,<br>
> "name" : "Martial Plot - 2 x 2",<br>
> "plugin_name" : "SimSettlements.esm",<br>
> "posX" : -35624.8515625,<br>
> "posY" : 59097.19140625,<br>
> "posZ" : 3894.25146484375,<br>
> "rotX" : 0.0,<br>
> "rotY" : 0.0,<br>
> "rotZ" : -188.41806030273437<br>
> },<br>
> <br>
> whitespace may have been lost a bit in the copy/paste, <br>
> my files have thousands of such objects, i need to find all objects where all <br>
> of the the keys FormID,posX,posY,posZ,rotX,rotY,rotZ are the same as another <br>
> object's and delete all but one of the 'duplicated' objects regardless of <br>
> whether any other key is the same.  i need to do this for objects in the same <br>
> file, and if possible for objects in two different files.<br>
> suggestions so far include learning python, and using jq, which man page i <br>
> have read and yes it seems to be a tool of sufficient power maybe, but i fear <br>
> i lack the chops to work out how to do all the necessary streaming and <br>
> filtering, <br>
> any other suggestions would be useful, <br>
> <br>
> bascule<br>
> <br>
> <br>
> <br>
> <br>
> -- <br>
> Swlug mailing list<br>
> <a href="mailto:Swlug@mailman.lug.org.uk" target="_blank" rel="noreferrer">Swlug@mailman.lug.org.uk</a><br>
> <a href="https://mailman.lug.org.uk/mailman/listinfo/swlug" rel="noreferrer noreferrer" target="_blank">https://mailman.lug.org.uk/mailman/listinfo/swlug</a><br>
<br>
-- <br>
Swlug mailing list<br>
<a href="mailto:Swlug@mailman.lug.org.uk" target="_blank" rel="noreferrer">Swlug@mailman.lug.org.uk</a><br>
<a href="https://mailman.lug.org.uk/mailman/listinfo/swlug" rel="noreferrer noreferrer" target="_blank">https://mailman.lug.org.uk/mailman/listinfo/swlug</a></blockquote></div>