HP3000-L Archives

October 2001, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Mark Bixby <[log in to unmask]>
Reply To:
Mark Bixby <[log in to unmask]>
Date:
Wed, 24 Oct 2001 17:23:38 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (34 lines)
Donna Garverick wrote:
> i've got a simple little text file with two pieces of
> information on each record.  the first 'word' (piece of
> information) could be considered as a key value.  that is --
> another process will be examining this file looking for a
> match on the first field.  (and btw, since i know the
> data....most of the time the match will fail....).  if a
> match is found, i need the 2nd 'word' (piece of information)
> placed into a ci variable.  sound rather simple....except
> that last piece -- getting the information from the file
> into a variable.

The POSIX join program might be useful here; see "man join" for details:

INVENT3K:/BIXBY/PUB/demo/join$ cat datafile
1 one
2 two
3 three
INVENT3K:/BIXBY/PUB/demo/join$ cat doit
#!/bin/sh

KEY=2

callci setvar value "'$(echo $KEY | join -o 2.2 - datafile)'"
callci showvar value
INVENT3K:/BIXBY/PUB/demo/join$ doit
VALUE = two
--
[log in to unmask]
Remainder of .sig suppressed to conserve scarce California electrons...

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2