From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10695 invoked from network); 22 Jan 1998 04:24:07 -0000 Received: from ns2.primenet.com.au (7795@203.24.36.3) by ns1.primenet.com.au with SMTP; 22 Jan 1998 04:24:07 -0000 Received: (qmail 931 invoked from network); 22 Jan 1998 04:24:01 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns2.primenet.com.au with SMTP; 22 Jan 1998 04:24:01 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id WAA09640; Wed, 21 Jan 1998 22:53:10 -0500 (EST) Resent-Date: Wed, 21 Jan 1998 22:52:37 -0500 (EST) Message-ID: <19980121225425.23392@astaroth.nit.gwu.edu> Date: Wed, 21 Jan 1998 22:54:25 -0500 From: Sweth Chandramouli To: zsh-users@math.gatech.edu Subject: related question References: <199801150012.TAA07173@luomat.peak.org> <199801151028.KAA21473@taos.demon.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.88e In-Reply-To: <199801151028.KAA21473@taos.demon.co.uk>; from Andrew Main on Thu, Jan 15, 1998 at 10:28:37AM +0000 Resent-Message-ID: <"3gDiD3.0.3M2.4Ainq"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1246 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Thu, Jan 15, 1998 at 10:28:37AM +0000, Andrew Main wrote: > for ((i=0;i<=100;i++)); do > echo $i > done i've got a similar loop (just converted to this new for format, which i'm trying to get used to using), to set the values in an array: while read line ; do for ((i=1;i<=11;i++)) ; do field[$i]=`echo $line | cut -d';' -f$i | tr -d '"'` done done < in.file this should take a line of the format "foo1";"foo2";"foo3"; [...] ;"foo11" and stuff each foo# into the appropriate spot in the array named field. my question is, how do i then concatenate all of these values back into one line? what i'm currently doing, since the max value for i is so small, is just echo "\"$field[1]\";\"$field[2]\";\"$field[3]\";\"$field[4]\";\"$field[5]\";\"$field[ 6]\";\"$field[7]\";\"$field[8]\";\"$field[9]\";\"$field[10]\";\"$field[11]\"" pretty soon, however, i'm going to have to use this script on a larger set of data, with a lot more fields per line; i don't want to have to type out each item of the array individually. i know there's an easier way to do it, but it's late, and my brain isn't working very well. any suggestions (other than using perl, which is what all of my coworkers say to do)? tia, sweth. -- "Countin' on a remedy I've counted on before Goin' with a cure that's never failed me What you call the disease I call the remedy" -- The Mighty Mighty Bosstones