Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!sdd.hp.com!ucsd!ucbvax!are.berkeley.edu!casterln From: casterln@are.berkeley.edu (Gary Casterline) Newsgroups: comp.lang.perl Subject: sh can do it -- how about perl? Message-ID: <36587@ucbvax.BERKELEY.EDU> Date: 29 May 90 06:43:43 GMT Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: casterln@are.berkeley.edu (Gary Casterline) Distribution: usa Organization: Department of Agricultural and Resource Economics, UC Berkeley Lines: 27 The following little script works fine. It's part of the code in "UNIX Relational Database Management", by Manis, Schaffer and Jorgensen. I'd like to do something similar in perl, but I'm having trouble getting the right pipe(s) set up. The idea is to use one program for both 'tables' and 'lists' by formatting a 'listfile' temporarily as a 'tablefile', feeding this data (in 'tableform') back into itself, and finally translating back to the original list format. I like the idea and its so short in sh: #!/bin/sh read HEAD if test -z "$HEAD" # first line blank means listfile then (echo; cat) | listtotable | $0 $* | tabletolist exit 0 fi [... further processing on 'table' using sh and awk not shown ...] I must admit I'm learning a lot in my efforts to duplicate this, but I'm sure there must be a cleaner way than the avenues I've explored so far. Any ideas would be greatly appreciated. ---- Gary Casterline . ._ ._ Agricultural & Resource Economics casterln@are.berkeley.edu /-\ |< |-_ 207 Giannini Hall (415) 642-5583 UC Berkeley, CA 94703 ----