home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.perl:5040 comp.unix.programmer:4019 comp.unix.shell:3210
- Path: sparky!uunet!wupost!usc!sol.ctr.columbia.edu!ursa!buzz
- From: buzz@toxicavenger.bear.com (Buzz Moschetti)
- Newsgroups: comp.lang.perl,comp.unix.programmer,comp.unix.shell
- Subject: A Tool Challenge...which lang is best?
- Message-ID: <BUZZ.92Jul30123306@toxicavenger.bear.com>
- Date: 30 Jul 92 16:33:06 GMT
- Sender: news@ursa.UUCP
- Reply-To: buzz@fsrg.bear.com
- Distribution: comp
- Organization: Bear, Stearns & Co. Inc.
- Lines: 45
-
- I need a tool that returns a context-dependent value string given an input key.
- Below is a sample of the resource DB that is evaluated by this tool:
-
- #
- # Comment!
- #
- MRX.MACHINE node1 \
- dev!node2 \
- test!node3
-
- MRX.ROOTDIR /tmp dev!/usr/tmp
-
- MRX.NAME user1 \
- dev!"two names"
-
- MRX.DB $MRX.MACHINE:$MRX.ROOTDIR/the_db $MRX.NAME\
- dev!$MRX.MACHINE:$MRX.ROOTDIR/other_db $MRX.NAME
-
- Assuming the tool is called xxx, here are sample of the expected output:
- $ xxx MRX.MACHINE
- node1
- $ xxx -domain test MRX.MACHINE
- node3
- $ xxx MRX.DB
- node1:/tmp/the_db user1
- $ xxx -domain dev MRX.DB
- node2:/usr/tmp/other_db "two names"
- $ xxx MRX
- MACHINE node1
- ROOTDIR /tmp
- NAME uesr1
- DB node1:/tmp/the_db
- $
-
- Notes:
- 1. \ will escape the CR.
- 2. The input key is always of the form "object.attribute."
- 3. Fetching just the object returns all attributes and their values, one pair
- to each line, separated by a space.
-
- I can implement this tool using C, but I'd prefer not to if I can do it
- using sh(1) and Un*x tools or perl, especially since the basic task of this
- tool seems to be variable interpolation.
-
- Any suggestions?
-