From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Andrew B. Cramer" Subject: Re: Scripting question Date: Wed, 22 Jan 2003 23:32:43 -0600 Sender: linux-admin-owner@vger.kernel.org Message-ID: <3E2F2A1B.28642.45C8626@localhost> References: <000901c2c29e$46f751f0$0700a8c0@amr.corp.intel.com> Reply-To: andrew.cramer@cramer-ts.com Mime-Version: 1.0 Content-Transfer-Encoding: 7BIT Return-path: In-reply-to: <000901c2c29e$46f751f0$0700a8c0@amr.corp.intel.com> Content-description: Mail message body List-Id: Content-Type: text/plain; charset="us-ascii" To: Michael French , linux-admin@vger.kernel.org Hi Michael, Switch to PERL. You open the input files, then open the output file, sort, and write. Perhaps if there are duplicates, you need additional information, like a datestamp for each entry to compare. (.02) - Andrew On 22 Jan 2003 at 21:14, Michael French wrote: > I have a couple of scripts that I am working on that pull data from an > application and print a human readable report from the data. I have all of > the data pulled and stored in variables, but I am stumped on how to put in > all in one file. I hope that I can clearly explain this, here goes. > > For one script, I have three pieces of info to report: node name, > customer name, and total data stored. The first two bits of data are > getting pulled out together and stored in one file. The third bit is being > calculated and then stored in a second file. I then get the data in like > this: > > NODES=`cat nodeinfo.txt | awk '{print $1}'` > CUSTOMER=`cat nodeinfo.txt | awk '{print $2}'` > MBTOTALS=`cat mbtotals.txt` > > I then need to print out a report like: > > Nodes Customer MB > ---------------------------------- > node1 customer1 20.0 > > How can I do this? I can't seem to figure out how to do it with one for > loop. > > I have another little script I am working on to report restore data and > it has one temp file holding all of the info I need and is greping out about > 10 different pieces of data I need before overwriting the temp file with the > info on the next node. The problem I have run into is that some of the > restores have duplicate data in them so I am going to have to rewrite the > report to put the data in variables and then loop through them to generate a > report just like the one above, except with more variables so you can see > why I am trying to figure out how to do this as cleanly as possible. Maybe > I am starting off all wrong so feel free to redirect me. Also, I am using > Korn shell to do this (my only option). > > Thanks! > > Michael French > > - > To unsubscribe from this list: send the line "unsubscribe linux-admin" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >