rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: haahr@adobe.com (Paul Haahr)
To: rc@archone.tamu.edu
Subject: pairwise concatenation (a winner)
Date: Fri, 30 Aug 1991 10:36:26 -0500	[thread overview]
Message-ID: <9108301536.AA02270@adobe.com> (raw)

and the winner is... Malte.

after upping the prize and offering a cash alternative, i actually got
responses.  (2 even!)  both arrived within a day or two of my announcing
raised stakes, and within an hour or so of each other.  Byron and i
picked this one as the winner.  [this note should have gone out a couple
of days ago, but i've been swamped getting things done at the office before
leaving on vacation today.]

here's Malte's note:

> I recently discovered a useful application for pairwise concatenation. I use
> in a set of shell scripts that helps me adding users to our LAN.
> While applying different checks on the consistency of the group and
> passwd database I split up their entries and assign them to variables to
> avoid frequent calling of cut, sed, grep, awk, ...
> 
> 	acct=`{cut -f1 -d: /etc/passwd}
> 	pswd=`{cut -f2 -d: /etc/passwd} ...
> 
> After doing the checks I reconcatenate passwd by using
> 
> 	output=($acct)^':'^($pw)^':'^($uid) ...
> and then
> 	for( i in $output ){ echo $i }
> 
> This is quite specific and probably of little help to non-sysops.
> But being more general:
> 	pairwise concatenation gives you a tool (device?) which helps
> 	simulating two dimensional arrays. As a special application
> 	it provides access methods for simple relational databases,
> 	as is /etc/passwd and /etc/group, where the relation is the
> 	gid-field.
> 
> I haven't spent much thought on that, but I guess there are several
> situations where this is applicable, one just doesn't see them because
> being still to deep into bourne shell.

as a side note, i should add that i actually found use for pairwise
concatenation this week, when i discovered that NeXT does not ship
cut and paste with their machines.  ^ is a reasonably good substitute
for paste, which is part of how Malte suggests using it.

now the important question:  do these uses provide a good enough justification
for leaving pairwise concatenation in rc, except for backward compatibility
reasons?  in our oh-so-clean, minimalist shell, (not, imho, a "spartan toy")
is this a worthwhile feature?

that said, congratulations Malte!  i'll have a check in the mail as
soon as i can figure how to convert it to marks.  (and where to send
it, given i don't know your address or last name.)


                 reply	other threads:[~1991-08-30 21:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9108301536.AA02270@adobe.com \
    --to=haahr@adobe.com \
    --cc=rc@archone.tamu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).