From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from minnie.tuhs.org (minnie.tuhs.org [45.79.103.53]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 7b0d8c61 for ; Wed, 22 Jan 2020 07:30:17 +0000 (UTC) Received: by minnie.tuhs.org (Postfix, from userid 112) id 7584E9C208; Wed, 22 Jan 2020 17:30:16 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id EA3B09C1FF; Wed, 22 Jan 2020 17:29:59 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="bV7ACG+9"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id AE7299C1FF; Wed, 22 Jan 2020 17:29:58 +1000 (AEST) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by minnie.tuhs.org (Postfix) with ESMTPS id 314B19C14A for ; Wed, 22 Jan 2020 17:29:57 +1000 (AEST) Received: by mail-lf1-f54.google.com with SMTP id v201so4477576lfa.11 for ; Tue, 21 Jan 2020 23:29:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xbpEzLgs5Ofhar0lpIIhJb9ifv6JcyPyToNKKomRMwY=; b=bV7ACG+99ykdd17+rGyfu+RpC+rcxg7x3U6sJ4PRtQnzA9B0qxJ3eUd3Jg42gXF74a foE6pGOTrtG3FHoeF5bB5kT0Zlaqosjn3S6+MRkcfbz4nkwCDW9P2ddnT+d1B9yAJiDu gbDlw1lYkn+fFNTUspNoZSaNQNjURrl7XCeiv3oZCM/65sf9Peh8wyDNcgcRPBhsV3Sr /ykLUF6iB/5TEA+XTBtj49jL1kI2Vz4RS7iTXHXQF+Ehf8dWP//Kvx9PHdPx/0DO48Hk XIbn9qxKFAY20keOMdWLrXe9aXkuX3Wx742ncyuYe96VArdSp/QDvWPdAYuIM2nYqTCL Nurg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xbpEzLgs5Ofhar0lpIIhJb9ifv6JcyPyToNKKomRMwY=; b=Eg3xJlWlnARJIOHPMMYhp+PoIvUIatcsuN7iBHJmeFAk4Tj/XQe6sn2WYJoBZUeSc9 FDnpe36X/zRovs5X3Oi5bsCXbMQ5yFV4rKsZKsm+Ctf2bOH363s7vs8hLflOPdVcnnS0 aY1EzFhWAm5kUMKva1f7gxcxCdMiC2/WVc6r+bn6GCaPC0LIs7/jZj31ocqpyGtmrCe6 cF56NTYkmD3AvZTwP15YTtARyRUr+VLzwQLqENn5iIVN2rhVndAmthvF6ur+9jKk28QR F6ED+oLZg7cyp8Xd7b2iRI7Fx6rcyWnCAmQKqzn5bQUZBrTDAoFr+WGPJeLrV2m2QWUP Djrw== X-Gm-Message-State: APjAAAXx2dLZrHxbFh//otlGqxZH9UK8P7RRhGQlFskFBlC9lP5SJv0y XohN0pQG07ZvgLqyRzB1DjGT4DIQr4cxmfTePXi7G/0= X-Google-Smtp-Source: APXvYqye0PLgS+Oxky5BwmiOd8xIe6xu2TKGvcgjDMF3vEAuZt9/c+IsKTiYyZZ2Yzd6khWdcCYyO1qRu2yOEN7zgKY= X-Received: by 2002:a19:5e0a:: with SMTP id s10mr966418lfb.165.1579678195496; Tue, 21 Jan 2020 23:29:55 -0800 (PST) MIME-Version: 1.0 References: <202001122034.00CKYQ39571239@darkstar.fourwinds.com> <202001122044.00CKiUNV573279@darkstar.fourwinds.com> <202001122137.00CLbMrw582813@darkstar.fourwinds.com> <20200121215746.GB25322@clarinet.employees.org> <202001220721.00M7Ll5D021031@freefriends.org> In-Reply-To: <202001220721.00M7Ll5D021031@freefriends.org> From: Tyler Adams Date: Wed, 22 Jan 2020 09:29:43 +0200 Message-ID: To: arnold@skeeve.com Content-Type: multipart/alternative; boundary="000000000000b3bfe3059cb57dca" Subject: Re: [TUHS] Tech Sq elevator (Was: screen editors) [ really I think efficiency now ] X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tuhs@tuhs.org Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" --000000000000b3bfe3059cb57dca Content-Type: text/plain; charset="UTF-8" Also for anything where jq gets too complicated, you can use python to whip up an arbitrary json filter Theres only 5 lines of boiler plate import json import sys d = json.load(sys.stdin) # your code here print(json.dumps(d)) Tyler On Wed, Jan 22, 2020, 09:22 wrote: > > On Sat, Jan 18, 2020 at 09:45:22AM -0600, Michael Parson wrote: > > > > > > And here, understanding the model is important, namely, grep is the > > > wrong tool for searching/parsing JSON output. Dealing with JSON from > the > > > shell, you should use jq. I've been dragged kicking and screaming into > > > dealing with JSON, and about all I can say about it is, I like it about > > > this >< much more than XML. :) > > Derek Fawcus wrote: > > If push comes to shove, one can always use xmlawk (xml extension for > gawk) > > to beat the latter in to submission. > > There is also a simple JSON extension for gawk in the gawkextlib project > that can suck in a single JSON record and turn it into a gawk > multidimensional array, and vice versa. (Gawk has true multidimensional > arrays and isarray/typeof functions so that you can easily traverse > such an array.) > > (Toot!) > > Arnold > --000000000000b3bfe3059cb57dca Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Also for anything where jq gets too complicated, you= can use python to whip up an arbitrary json filter

Theres only 5 lines of boiler plate=

import json
import sys
d =3D json.load(sys.stdin)
# your code here
print(json.dum= ps(d))

Tyler

On Wed, Jan 22, 2020, 09:2= 2 <arnold@skeeve.com> wrote= :
> On Sat, Jan 18, 2020 at 09:4= 5:22AM -0600, Michael Parson wrote:
> >
> > And here, understanding the model is important, namely, grep is t= he
> > wrong tool for searching/parsing JSON output. Dealing with JSON f= rom the
> > shell, you should use jq.=C2=A0 I've been dragged kicking and= screaming into
> > dealing with JSON, and about all I can say about it is, I like it= about
> > this >< much more than XML. :)

Derek Fawcus <dfawcus+lists-tuhs@employees.org> w= rote:
> If push comes to shove, one can always use xmlawk (xml extension for g= awk)
> to beat the latter in to submission.

There is also a simple JSON extension for gawk in the gawkextlib project that can suck in a single JSON record and turn it into a gawk
multidimensional array, and vice versa.=C2=A0 (Gawk has true multidimension= al
arrays and isarray/typeof functions so that you can easily traverse
such an array.)

(<horn ownership=3D"mine">Toot!</horn>)

Arnold
--000000000000b3bfe3059cb57dca--