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.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, 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 50c1f496 for ; Wed, 4 Mar 2020 23:27:23 +0000 (UTC) Received: by minnie.tuhs.org (Postfix, from userid 112) id 5DBEB9D739; Thu, 5 Mar 2020 09:27:21 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 92A729D72C; Thu, 5 Mar 2020 09:26:19 +1000 (AEST) Received: by minnie.tuhs.org (Postfix, from userid 112) id 940C19D68F; Thu, 5 Mar 2020 09:25:19 +1000 (AEST) X-Greylist: delayed 340 seconds by postgrey-1.36 at minnie.tuhs.org; Thu, 05 Mar 2020 09:25:18 AEST Received: from sdaoden.eu (sdaoden.eu [217.144.132.164]) by minnie.tuhs.org (Postfix) with ESMTPS id B7F3D9D71B for ; Thu, 5 Mar 2020 09:25:18 +1000 (AEST) Received: by sdaoden.eu (Postfix, from userid 1000) id BDC4716054; Thu, 5 Mar 2020 00:19:36 +0100 (CET) Date: Thu, 05 Mar 2020 00:19:36 +0100 From: Steffen Nurpmeso To: Random832 Message-ID: <20200304231936.hyOtO%steffen@sdaoden.eu> In-Reply-To: <5019a751-d69a-4839-9a56-b977b275070d@www.fastmail.com> References: <202003031815.023IFSlD493028@darkstar.fourwinds.com> <5019a751-d69a-4839-9a56-b977b275070d@www.fastmail.com> Mail-Followup-To: Random832 , "Grant Taylor via TUHS" User-Agent: s-nail v14.9.17-52-g56288e6a OpenPGP: id=EE19E1C1F2F7054F8D3954D8308964B51883A0DD; url=https://ftp.sdaoden.eu/steffen.asc; preference=signencrypt BlahBlahBlah: Any stupid boy can crush a beetle. But all the professors in the world can make no bugs. Subject: Re: [TUHS] Command line options and complexity 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: Grant Taylor via TUHS Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" Random832 wrote in <5019a751-d69a-4839-9a56-b977b275070d@www.fastmail.com>: |On Tue, Mar 3, 2020, at 13:44, Adam Thornton wrote: |> I've heard people say that there isn't really any alternative to this |> kind of complexity for command line tools, but people who say that have |> never really tried the alternative, something like PowerShell. I have |> plenty of complaints about PowerShell, but passing structured data |> around and easily being able to operate on structured data without |> having to hold metadata information in my head so that I can pass the |> appropriate metadata to the right command line tools at that right |> places the pipeline isn't among my complaints3 |> . |> |> Somewhat disingenuous. I mean, yes, that's true, but on the other hand |> it means that you have to keep the "what Powershell commands operate on |> what structure" in your head instead, since you can no longer assume |> the pipelines to be a universal interface. | |Sure, but "stdin is a sequence of any type, and the argument is an \ |expression that operates on that type or the name of a property that \ |that type has" is universal enough. | |The part that has to operate on a specific structure isn't the command, \ |it's the arguments. | |For example, a powershell pipeline to produce a list of files sorted \ |by modified date is: | |gci . | sort lastwritetime | select name ... |*assuming that ls -t didn't exist*, to do this with unix tools that \ |operate on text you would need: | |ls -l | [somehow convert the date to a sortable format, probably in \ |awk] | sort | [somehow pick the filename alone out of the output - \ |possibly with cut or sed or awk again] | |and it's very difficult to get tools like awk, sort, and cut to work \ |on formats that contain more than one field that may contain embedded \ |spaces (you can just about get away with it for ls output because the \ |date is always three "words"). Yes, that is really bad, except only that a lot of output is pretty portables since a very long time. FreeBSD started using libxo in many base utilities, which can output in structured formats. This includes CSV and even CBOR :), i do not know how the latter integrates in Unix text utilities however. (I think the format string syntax, that a bit originates in QT ??, could have been warped to something better, like the Python ones, plus further extensions, however. But it is an improvement to what the standard formats end up with when reordering etc. comes into place.) --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt)