Deutsch   English   Français   Italiano  
<87msi74ia2.fsf@axel-reichert.de>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Axel Reichert <mail@axel-reichert.de>
Newsgroups: comp.unix.shell
Subject: Re: Splitting in shell (bash)
Date: Sun, 10 Nov 2024 09:14:45 +0100
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <87msi74ia2.fsf@axel-reichert.de>
References: <vgo225$91aq$1@news.xmission.com>
	<vgphsj$9p84$1@news.xmission.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Sun, 10 Nov 2024 09:14:46 +0100 (CET)
Injection-Info: dont-email.me; posting-host="92b2a7fd767833e89a614ce72197aac0";
	logging-data="314380"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/6iCHLaL1T+sRjW5j2suHQ4RUIVzxPcN0="
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:fe0N1hx38W4NJQ0Q+EeOFMC06sQ=
	sha1:AkHe1UDd20coWxgh/RTyH2LKMug=
Bytes: 2109

gazelle@shell.xmission.com (Kenny McCormack) writes:

> Kenny McCormack <gazelle@shell.xmission.com> wrote:
>>	mapfile -td ';' < <(someprocess | awk 1 ORS=)

[...]

> 	mapfile -t < <(someprocess | sed 's/;/\n/g')

And in your original post you wrote:

  There is a feature that is prominently missing from the shell language
  (I am speaking primarily of bash here) - which is the ability to split
  a string on a delimiter. This is a common operation in most other
  text-processing oriented languages (AWK, Perl, etc).

So why bother with a shell solution and why bother with avoiding IFS,
when in the end you need to resort to AWK/sed anyway?

Do not get me wrong, I am learning a lot in this thread here, much of
the stuff is far beyond my level of expertise in shell programming, and
it would be great to have a shell-only solution for your inquiry, even
if only for "academic reasons" because, say, the solution (still to
come) may turn out to be too clumsy for daily use). I will applaud such
a result, but for the time being I would be happy if you could elaborate
somewhat more about your motivation for this exercise.

Best regards

Axel