From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 3BA7422305 for ; Wed, 22 May 2024 07:58:31 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1716357511; b=aNR0NFjeS8lL03hc6AJ6GshXQaixSBkgFaGwFkPImrWpm8OzYGpwcf2qV6cYvg4izLUxSgHUy9 tZDFbGtlDgtnvpN/u9KUUnyTgk09X8iZsQOaKb50/E8U1zStAVJcfHQq2+M5DXsP0P5fg9G9pG x03TGrovyie2rdXJfcA1ssfGEF03LS4Ok7h0X8e/QHcs3tI3778qqLpd+pwYgm47OuTMOvLl/6 qR5jCljCpYTP2HhtMgj77xdjZyHKTF1gsmeflraBKsj55xtD82zq8tYtYIwsnIQgPInBcUX0Hn A2p6bsWBOACtzkUKd7/9hbeL1EC6V/zxPsvR8eVS2HP9uA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-pj1-f53.google.com) smtp.remote-ip=209.85.216.53; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1716357511; bh=DccnstKD6PdY+lMu+tP8fX3vBkBsW9oqqJv4etmK28E=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:Reply-To: In-Reply-To:References:MIME-Version:DKIM-Signature:DKIM-Signature; b=sEs5c3RGUn8rgdEjOzzQoFV41+sxkF3J2FPNguI/adYfu1+Ss/AStH4ZgRUEozL1aqJgy5a3g6 3ukCThwWpJcjJS2tIPzvrAG9z+yeZmRW/RmD8fMKQoLsSZTo46y6CY3hdKdFm97XNpb73uQ8pw cJvJBFU1h/fuE8vuhXUHxxxvOTLBX//3i2Bb4ZYvTLf3yQS/6exdEFEWLLaBIuE1P5LvBSne3g ilE2hmS9JzcsAuWpQYCMslZsck8XUnfIExDNVpa7JKP7Pp2pYS2+XikbY6OGujaSe6Yfra0Vk4 hMEsDAX3YrXFY0eWPiqH4I7KoirAv7K59RJHccVDPCmJAA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:Reply-To:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=9sbklnIgOR37K9m3xS+JWRw1FmfF/D2VYaWP+VQCqXc=; b=Lao1unaTVxf+ofdGt35+CJcD7z awLd1nhF475rf73hL/FGvgBqsoPsh7BlowyO0U/NLwX4VReUPrqTCrtmhisukZSmynmKfDRPEQCbe kpsdUPQa2RtnTf21qtyLS2BfehLRqQqDYwGGourw/zSEqYWK+cy2C/OYJ+7HYJJmp5cXpxxx5JUo3 HwrLDcg1AtIGTXTdl3F0+lWagZ+FMUgWb8jSWQdS4x/nSfFmH+G2spek1q/5OcQam164pZ6rvQu9k pDU1uyz7Rx//Tf9JB4UZKKRcj1utVhpnqfSDCU03KsfEq0DQH8V7UFpxQkQ/G85+iCBAUvTNARVkJ VJ+xAhkQ==; Received: by zero.zsh.org with local id 1s9ezf-000HAi-4H; Wed, 22 May 2024 05:58:31 +0000 Authentication-Results: zsh.org; iprev=pass (mail-pj1-f53.google.com) smtp.remote-ip=209.85.216.53; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-pj1-f53.google.com ([209.85.216.53]:51580) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1s9eys-000GKF-Ic; Wed, 22 May 2024 05:57:43 +0000 Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-2b992409093so823037a91.3 for ; Tue, 21 May 2024 22:57:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716357461; x=1716962261; darn=zsh.org; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=9sbklnIgOR37K9m3xS+JWRw1FmfF/D2VYaWP+VQCqXc=; b=ikCR9PnJ+BELxA7doNk9H0mA2N2zdmh9nbxllXanTiymlqIJ85rDQVBdtYqj8rieUd Ds2gxhMdZt+ynwLaHKlCJfQgjKSpXyyJu9KfphA+wKxBHsrM2NihBiwwn3tlthkRKKZc DMVC4jDQyZSElE22rrRxAdSDBwYeDd88vjFWey6vCerSKD7SyfEK/SxcYE8SW1GU8yMT gujHfXICuSlhoP/NNPdjubsb7ZytzffwG2W0Lil7xBBRyTDv3w96VI8Ab05nWt7mmLT3 /W4L1DsvVbFvk67VejdVOuXlaQMyuIpYmtF/2ikzJy2Wb1sg/l5g3nU5GGkqxow5L7WH go6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716357461; x=1716962261; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9sbklnIgOR37K9m3xS+JWRw1FmfF/D2VYaWP+VQCqXc=; b=THU0u/v2ZT4dAlcn/DN5I9oINgi7JircDgiwtTyNiBJD5GC0grlkVKSszoSTlcD+Ng ryt7Wq+qsTOf5Of4GcuhFQv3gFHCm7LCcpGNuyc3VxbIR0z70GkVq8Hn9GPvU0EvHW0Y jf+vMKyaYQRgVMNZ+1e66/bTOMyUs5TUhiFiz2t82sjEYzvD+9z7hb6HD8JsSqWrcTpO grG2oLM7u5Y+SW+iqYI9MVn1IT220ma5A6apThsXoEeNcefaVmTJy0Oq6Y6FOWC8T3JC WLHNPgBwXWQDcwlxB/c6IWfR+bs9qp6CDiWhJSY6WgVQd809jEMUbCyWpm5eRICJQGXr p/wA== X-Gm-Message-State: AOJu0YyYW0J8reShLcsmoSj/Zhn1ezeGSbGiHUIkSsdqNuTJcXaduExI j0n3noDXoMooGkCwp95+gNqiGTFyHz0+Xa5nU1kxamIGMV7lCiFNXdQ2Krm5mxbbfA3RAvVN/q/ varpXGMpBztDuf/ToyL16mYh4aZlPzGxu X-Google-Smtp-Source: AGHT+IGKmm3ZxoN4gOk4avnsRbRLJy+S7io3qCwy6+psJtvf4Hg3D7+NkopRxO6+uMZU/aUqP1XfQtf1DrP3XO/Z7ms= X-Received: by 2002:a17:90a:550e:b0:2b5:258c:5f0d with SMTP id 98e67ed59e1d1-2bd9f461df4mr1089444a91.11.1716357461171; Tue, 21 May 2024 22:57:41 -0700 (PDT) MIME-Version: 1.0 References: <75784205-3d78-4dd8-8474-e2eb48598307@eastlink.ca> <0b6a048b-4fbf-4162-a31a-d5f6f963d72a@eastlink.ca> In-Reply-To: <0b6a048b-4fbf-4162-a31a-d5f6f963d72a@eastlink.ca> Reply-To: linuxtechguy@gmail.com From: Jim Date: Wed, 22 May 2024 00:57:28 -0500 Message-ID: Subject: Re: the splits To: Ray Andrews Cc: zsh-users@zsh.org Content-Type: multipart/alternative; boundary="000000000000c7e4600619049c0c" X-Seq: 29966 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: --000000000000c7e4600619049c0c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Ray, On Tue, May 21, 2024 at 9:21=E2=80=AFPM Ray Andrews wrote: > > On 2024-05-21 18:48, Mark J. Reed wrote: > > Running *lsof* *| grep* seems a bit silly. Can't you just do *lsof > $mountpoint*? > > When I want to select columns I usually reach for *awk*: > > *sudo lsof $mountpoint | awk '{print $1, $NF}'* > > > Beautiful, nuts' I just presumed I needed to grep for that. Much faster > your way. As for awk, I don't know anything about it, but googling for > help on various issues, one sees awk coming to the rescue all the time. = I > half way learned sed, but I think I should have learned awk. One little > thing, can I have the first and last columns, but with a tab between, or > some other columnizer?: > > COMMAND NAME > zsh /mnt/sda/5/boot > geany /mnt/sda/5/boot > Maybe something like this would work for you. Except for lsof it is all shell code. L=3D15 # insure first field reserves L columns (adjust as needed) lsof $mountpoint | \ while read -r line ; do print -- ${(r.L.. .)${=3Dline}[1]} ${${=3Dline}[-1]} done Regards, Jim Murphy --000000000000c7e4600619049c0c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Ray,

On Tue, May 21, 2024 at 9:21=E2=80=AFPM Ray A= ndrews <rayandrews@eastlink.ca= > wrote:
= =20 =20 =20

On 2024-05-21 18:48, Mark J. Reed wrote:
=20
Running=C2=A0lsof | grep=C2=A0seems a = bit silly. Can't you just do lsof $mountpoint?

When I want to select columns I usually reach for awk:<= /div>

=C2=A0sudo lsof $mountpoint | aw= k '{print $1, $NF}'

Beautiful, nuts' I just presumed I needed to grep for that. Much faster your way.=C2=A0 As for awk, I don't know anything about it, = but googling for help on various issues, one sees awk coming to the rescue all the time.=C2=A0 I half way learned sed, but I think I should have learned awk. One little thing, can I have the first and last columns, but with a tab between, or some other columnizer?:

COMMAND=C2=A0=C2=A0=C2=A0 NAME
zsh=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /mnt/sda/5/boot
geany=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /mnt/sda/5/boot

Maybe something like th= is would work for you.=C2=A0 Except for lsof it is all shell code.

L=3D15=C2=A0 # insure first field reserves L columns (adju= st as needed)
lsof $mountpoint | \
=C2=A0 while read -r line ; do
= =C2=A0 =C2=A0 print -- ${(r.L.. .)${=3Dline}[1]} ${${=3Dline}[-1]}
=C2= =A0 done

Regards,

Jim Mur= phy
--000000000000c7e4600619049c0c--