From: "Michael French" <mfrench@ashevillemail.com>
To: rich+ml@lclogic.com
Cc: linux-admin@vger.kernel.org
Subject: Re: Scripting question
Date: Thu, 23 Jan 2003 18:34:45 -0800 [thread overview]
Message-ID: <001f01c2c351$28c2d660$0200a8c0@castor> (raw)
In-Reply-To: Pine.LNX.4.44.0301231649190.1319-100000@deadrat.localdomain
Thanks for the help everyone, I was able to do it with John Julian's
while loop, worked like a champ!
Michael
In case you missed, here's the code:
i=0
while [ -n "$cust[$i]" ]
do print "$node[$i] $cust[$i] $mb[$i]
i=$(( i + 1 ))
done
----- Original Message -----
From: <rich+ml@lclogic.com>
To: "Michael French" <mfrench@ashevillemail.com>
Cc: <linux-admin@vger.kernel.org>
Sent: Thursday, January 23, 2003 4:50 PM
Subject: Re: Scripting question
> Oops, change the "$1,$2,$3" to "$@" == Rich
>
> On Thu, 23 Jan 2003 rich+ml@lclogic.com wrote:
>
> > Date: Thu, 23 Jan 2003 16:46:51 -0800 (PST)
> > From: rich+ml@lclogic.com
> > To: Michael French <mfrench@ashevillemail.com>
> > Cc: linux-admin@vger.kernel.org
> > Subject: Re: Scripting question
> >
> > Got Perl?
> > ---
> > #!/usr/bin/perl
> >
> > format STDOUT_TOP =
> > Nodes Customer MB
> > ----------------------------------
> > .
> >
> > format =
> > @<<<<<<<<<<< @<<<<<<<<<<<<<< @>>>>
> > $1,$2,$3
> > .
> >
> > (open A,$ARGV[0]) && (open B,$ARGV[1]) or die $!;
> > write while split ' ',<A>.<B>;
> > ---
> >
> > Invoke as one of:
> > script nodeinfo.txt mbtotals.txt
> > script - mbtotals.txt < nodeinfo.txt
> > script nodeinfo.txt - < mbtotals.txt
> >
> > == Rich
> >
> > On Wed, 22 Jan 2003, Michael French wrote:
> >
> > > Date: Wed, 22 Jan 2003 21:14:15 -0800
> > > From: Michael French <mfrench@ashevillemail.com>
> > > To: linux-admin@vger.kernel.org
> > > Subject: Scripting question
> > >
> > > 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
> > >
> >
> >
> >
>
>
next prev parent reply other threads:[~2003-01-24 2:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-23 5:14 Scripting question Michael French
2003-01-23 5:32 ` Andrew B. Cramer
2003-01-23 7:40 ` urgrue
2003-01-23 8:38 ` Jude DaShiell
2003-01-24 0:46 ` rich+ml
2003-01-24 0:50 ` rich+ml
2003-01-24 2:34 ` Michael French [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-01-23 13:49 johnjulian1
2003-01-24 2:30 ` Mikhail Romanenko
2004-03-31 21:15 Scripting Question Scott@Charter
2004-03-31 22:08 ` Richard Nairn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='001f01c2c351$28c2d660$0200a8c0@castor' \
--to=mfrench@ashevillemail.com \
--cc=linux-admin@vger.kernel.org \
--cc=rich+ml@lclogic.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).