From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 18053 invoked from network); 12 Jan 2024 20:09:07 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 12 Jan 2024 20:09:07 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1705090147; b=LvgY1I8iNPQf/Pp6XXeFhWuhrPyZo0dshwOM59kA1F6CYGoYTqulwNo97iNWrzA14fgaqwu/HX piXyzzHPg9wxnpmeFj1tIpqOea4BL8trP1Z+WeYoAMZyv7UjaGzJLOJBK/v0ZoRACf8RU5bF1A zLIq8rXmRKwMPotbafCAJxsa4dHiXIKZwqzhC/Isqemrh9/ZhaaVvGxV0hk82gIDCXxQLKTqEm DY/i0Jh+JXulngvN6yXNePde2YM48694g6ovHp2ZpWmKQC7DLVcc5G8l/KnDSD3g3S6rO4asSk S0Mo3gSuy34yecggS7wVu0TJJXqxM9a+v5Ye8XdkMzLe0g==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f180.google.com) smtp.remote-ip=209.85.208.180; 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=1705090147; bh=/zQnZGccs/1ZmkHibHJzJqOLjELd3GSsiFZhML7utcI=; 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:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=IdwbeBy+0+v5UYYHL3gzya4F7h8QjbNh7WQayiuTcIjqIzaEMQJVDaqIfNwW968yaWS4E/xS+y GJeaCRzWQ3F2EXwJVnmI4dTez11IAvrKfO7a5A4RILrsj1Ip/duFo2ltZnQL4eFJLHfih5E9QY hh+Y0jSdas0itcRJ0OJOxFvqHSOmsguGfchbCwYMDOtOlca8dXT+amk5YDt2FNwJ5jouAnW7sq xXOpPDphLVcKxo6anSV3E8a+lH6Z7v+IY90tEGLHoXgfLrHswO13ck2QHBkyUwcT5LJltAafDj IOw5e3IeQ49gIa3OLrp6RFmIxFM/XMShiPflaapG2C3kqA==; 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:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=wr5XhA0OKcDmqYdrkpQoxyav0tvxAa8BnNEXjjMS12c=; b=rXiYVfMlRTGNSYv9bzrZAFaReQ SnOiv9tMCU+I2mRrNG4bqMIXTsB57idJ6kZr6vSAKFp0qpamggJkFurLglk9Zw0+Fk9vhW+FuaxnC 6iEZ0IpEi1Ca46RyB7r1IqUebxnR7w+RtTfS6P5c0rgfIE/MbQ3MLKVklv2q9lClT0qXn2BE2lfsH W8r/kq/uJDlbM3/Sy0kWCLH2D1ALWGPcTw6inD/L/z9RNtd5EfmPeYOranuuN75fXCbvuCiypXdhY 9F6KVJfelpZUNiK+kp+m1mBp6TIIchWI4QKOJNBFxicXV8X9xi6w2/Z09cJ5/xx6RYmPU2AAQTLRl GfjlEjSA==; Received: by zero.zsh.org with local id 1rONpy-000FHm-S8; Fri, 12 Jan 2024 20:09:06 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f180.google.com) smtp.remote-ip=209.85.208.180; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lj1-f180.google.com ([209.85.208.180]:47293) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rONow-000EaM-DJ; Fri, 12 Jan 2024 20:08:04 +0000 Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2cceb5f0918so73327181fa.2 for ; Fri, 12 Jan 2024 12:08:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705090081; x=1705694881; darn=zsh.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=wr5XhA0OKcDmqYdrkpQoxyav0tvxAa8BnNEXjjMS12c=; b=hDL1hWmMLVzdhBDkSXLmq1ghfNXWh291MhTXCBH+MSKCB2NV3ML1PNGKMbWcb+WBY+ WbdWG1W98GlMxu2LjZ/9/sGnUMRRdRgV1DVTTOjnNbUQyFQ52PsFjHX4rd5i2h6IdjS7 gqZUTBve3Cyb6gAcIjiL5R61hguY3D7xHWd0K8OAiGt1JM27Bv68Evm9UMm8cGyKMaLg UPrA7U7BM+FWauFBh5HmCPhUHYpqjcEerl1SIH68bU+63zPO/UzrXga4c09RXu1gLztm TMKeZxbV+bzYW0Il7LZUq6B2SHuaSRKuYsaUKhc1wEKlGIFozWCLHwg+JAcDYKOP5hp2 xWaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705090081; x=1705694881; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wr5XhA0OKcDmqYdrkpQoxyav0tvxAa8BnNEXjjMS12c=; b=TEuud4gn3+anri3fTO/EHk3M7O08f3dcwa2ISf4qOmdtRMxU7rCIEFJzyORv3eUbek 5xRiFOcQeVTPDk5XrzU8yATIowlv95tIEAxtYo6Ym+YadZ67+7S68luWv4CRINN9ONPg LAJzsA/pzZj8/vwk3HbTHmHNlbiSMbMIqKtAzAKwjNkssU0s0BsuQ+nQY74p23gDI+el 3Kdci9ApAQmEEfOWWC7BgLoqDBYF21IEd9CeVxH3+kxcIm7ekxwp4uSpb+kkZotIi/Kl bUg5ECojxJyWdN3wvJDOA+xwHFp6GyTsK7sPa1tWIJimIEedhHIIGGTBYbZo96BxqYp8 ybrQ== X-Gm-Message-State: AOJu0YzYD7GTtk6ybZPTBLKFIGAk2fbRd8x0IALtNncsFbklTEknhrbK AhFrQyA0SvrZkq2OjwutyFPYBjrAuISCSEJWVoY= X-Google-Smtp-Source: AGHT+IHlf9fAOZOhMqzcvE0IywRLs2YtVWrLO62acQrpGEEqrZciPQmvcvudF7R4rsbFn9Nm48Zzl9EFQMSUjXCoSt4= X-Received: by 2002:a2e:9ccc:0:b0:2cd:ea6:f907 with SMTP id g12-20020a2e9ccc000000b002cd0ea6f907mr683032ljj.105.1705090081394; Fri, 12 Jan 2024 12:08:01 -0800 (PST) MIME-Version: 1.0 References: <07b64afc-919c-4eff-9a5e-c31e81615f24@eastlink.ca> In-Reply-To: <07b64afc-919c-4eff-9a5e-c31e81615f24@eastlink.ca> From: "Mark J. Reed" Date: Fri, 12 Jan 2024 15:07:49 -0500 Message-ID: Subject: Re: more splitting travails To: Ray Andrews Cc: zsh-users@zsh.org Content-Type: multipart/alternative; boundary="0000000000009c9519060ec5384a" X-Seq: 29450 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: --0000000000009c9519060ec5384a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jan 12, 2024 at 2:57=E2=80=AFPM Ray Andrews wrote: > % vvar=3D( ${"$( OK, that's interesting, you're using array assignment syntax ( vvar=3D( ...= ) ) but you're only assigning a single value; after that assignment, $vvar[1] contains the entire contents of the file. The blank lines aren't getting lost here because they're inside that one string, rather than being their own standalone values. If you want to get the lines of the file into individual elements of an array, you can use the (f) expansion flag to split the file contents on newline. However, that will remove blank lines unless you also include the (@) flag to preserve them. Which gives the recipe I mentioned in my last message: % vvar=3D("${(@f)"$( --0000000000009c9519060ec5384a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Fri, Jan 12, 2024 at 2:57=E2=80=AF= PM Ray Andrews <rayandrews@eas= tlink.ca> wrote:
=20 =20 =20

% vvar=3D( ${"= $(<testfile2)"} )


= OK, that's interesting, you're using array assignment syntax ( vvar= =3D( ... ) ) but you're only assigning a single value; after that assig= nment, $vvar[1] contains the entire contents of the file.=C2=A0 The blank l= ines aren't getting lost here because they're inside that one strin= g, rather than being their own standalone values.

= If you want to get the lines of the file into individual elements of an arr= ay, you can use the (f) expansion flag to split the file contents on newlin= e. However, that will remove blank lines unless you also include the (@) fl= ag to preserve them.=C2=A0 Which gives the recipe I mentioned in my last me= ssage:

=C2=A0 =C2=A0 % vvar=3D("${(@f)"$= (<testfile2)"}")

--
Mark J. Reed <markjreed@gmail.com>
--0000000000009c9519060ec5384a--