rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* pairwise concatenation (a winner)
@ 1991-08-30 15:36 Paul Haahr
  0 siblings, 0 replies; only message in thread
From: Paul Haahr @ 1991-08-30 15:36 UTC (permalink / raw)
  To: rc

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.)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1991-08-30 21:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1991-08-30 15:36 pairwise concatenation (a winner) Paul Haahr

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).