From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from uucp-gw-1.pa.dec.com ([16.1.0.18]) by archone.tamu.edu with SMTP id <22533>; Fri, 30 Aug 1991 16:28:58 -0500 Received: by uucp-gw-1.pa.dec.com; id AA11305; Fri, 30 Aug 91 12:03:07 -0700 Received: by adobe.com (4.0/SMI-4.0) id AA02270; Fri, 30 Aug 91 08:36:26 PDT Date: Fri, 30 Aug 1991 10:36:26 -0500 From: haahr@adobe.com (Paul Haahr) Message-Id: <9108301536.AA02270@adobe.com> To: rc@archone.tamu.edu Subject: pairwise concatenation (a winner) 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.)