<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Create a lookup file or an array in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003694#M126992</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;My vote goes to the lookup file. This way you don't have to modify your script and you can give control to others to modify only the configuration.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
    <pubDate>Fri, 20 Jun 2003 17:25:11 GMT</pubDate>
    <dc:creator>Sridhar Bhaskarla</dc:creator>
    <dc:date>2003-06-20T17:25:11Z</dc:date>
    <item>
      <title>Create a lookup file or an array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003692#M126990</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;I was looking for some ideas on a config file which will be used as a lookup. &lt;BR /&gt;&lt;BR /&gt;What I am trying to achieve is I will be running a monitor script and when I receive an elert I would like to then check a config file to see who is the support team and the support manager. This will be based on the server name, application and maybe some other data I receive.&lt;BR /&gt;&lt;BR /&gt;I know I could have an entry in a config file like below and then use a while loop or a for loop to read in each line.&lt;BR /&gt;&lt;BR /&gt;# Support Team  Manager    Server  App  Object&lt;BR /&gt;Email     Email Joe Bloggs eclipse Exch  mail&lt;BR /&gt;&lt;BR /&gt;The while loop would then read in the file and check the detailes against the alert that has been generated from the server and send an email to the correct support team and manager if necessary. Do you think the above method is a good way to do this or any ideas on keeping this data so it is easy to maintain and add to or delete. &lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Fri, 20 Jun 2003 17:05:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003692#M126990</guid>
      <dc:creator>James Andertom</dc:creator>
      <dc:date>2003-06-20T17:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: Create a lookup file or an array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003693#M126991</link>
      <description>The one thing that I would suggest is that you add some sort of delimiter other than &lt;SPACE&gt; between the fields so that the fields themselves might contain spaces. I am a big fan of &lt;TABS&gt; myself rather than colon's or comma's because I just might legitimately need those characters as part of a field.&lt;BR /&gt;&lt;BR /&gt;What you describe would be very easy and fast in Perl, also awk, and doable in the shell.&lt;BR /&gt;I would lean towards Perl.&lt;BR /&gt;&lt;/TABS&gt;&lt;/SPACE&gt;</description>
      <pubDate>Fri, 20 Jun 2003 17:18:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003693#M126991</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-06-20T17:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Create a lookup file or an array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003694#M126992</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;My vote goes to the lookup file. This way you don't have to modify your script and you can give control to others to modify only the configuration.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Fri, 20 Jun 2003 17:25:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003694#M126992</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2003-06-20T17:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: Create a lookup file or an array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003695#M126993</link>
      <description>Hello!&lt;BR /&gt;&lt;BR /&gt;This looks ok just use sleep in your loop&lt;BR /&gt;you don't need to check about 50 times in sec.&lt;BR /&gt;&lt;BR /&gt;Also check that you work with file so if you&lt;BR /&gt;open it close in the end (all in loop)&lt;BR /&gt;&lt;BR /&gt;In the end see that this script when he run&lt;BR /&gt;the preformance of running.&lt;BR /&gt;&lt;BR /&gt;Caesar</description>
      <pubDate>Fri, 20 Jun 2003 17:32:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003695#M126993</guid>
      <dc:creator>Caesar_3</dc:creator>
      <dc:date>2003-06-20T17:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: Create a lookup file or an array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003696#M126994</link>
      <description>I'm doing something along those lines where I have a file called Phones.db and it contains contact information for my department.&lt;BR /&gt;I then have a script monitoring for particular issues and if one arises, depending on the issue I just do a for loop against the Phones.db file and a grep for the name I want.  When a match is found, I pass that variable to sendmail and send a message out to that users phone.&lt;BR /&gt;&lt;BR /&gt;excerpt from Phones.DB&lt;BR /&gt;Name Phone# Email &lt;BR /&gt;Jim  XXXXXX XXXXX&lt;BR /&gt;Bob  XXXXXX XXXXX&lt;BR /&gt;&lt;BR /&gt;excerpt from Monitor.sh&lt;BR /&gt;for i in `grep $USER Phones.DB | /usr/bin/awk '{print$2}'`&lt;BR /&gt;&lt;BR /&gt;I would probably use Perl as Clay said but don't know it yet, I will soon hopefully though as I picked up a couple of books he recommended.&lt;BR /&gt;&lt;BR /&gt;Jim Mallett&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Jun 2003 17:45:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003696#M126994</guid>
      <dc:creator>Jim Mallett</dc:creator>
      <dc:date>2003-06-20T17:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: Create a lookup file or an array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003697#M126995</link>
      <description>The world-class cinch way to do this is to put the server name in front of every chunk of data.  Then do something like:&lt;BR /&gt;for USERINFO in `grep HOSTNAME /usr/configfile|awk '{ print $2,$3, $4 }'&lt;BR /&gt;do&lt;BR /&gt;echo $USERINFO&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Fri, 20 Jun 2003 17:56:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003697#M126995</guid>
      <dc:creator>Chris Vail</dc:creator>
      <dc:date>2003-06-20T17:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: Create a lookup file or an array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003698#M126996</link>
      <description>your application is only going to be as fast as it can get the information.  And, reading from a file line by line is about as slow as it gets.  But, it seems like your only going to have a few lines to deal with and it shouldn't impact performance very much.  And, your scripting is going to be simplier and faster to complete. &lt;BR /&gt;&lt;BR /&gt;something faster, but more complex would be to do something like NIS and create files with appropriate indexs from your configuration file.  Then, instead of looping through every line, a simple grep using the index will return your desired information.  &lt;BR /&gt;&lt;BR /&gt;This method does require updating your index files whenever there is a change to your configuration file, creating an extra step whenever a change is made. But, your probably going to create a front end script to make changes to your configuration file. &lt;BR /&gt;&lt;BR /&gt;A script that asks the user for the required information and does some error checking/data validation before adding/deleting it to/from your configuration file.  This front end would also limit one user at a time to be making changes.  &lt;BR /&gt;&lt;BR /&gt;It would be easy to add your index updating to such a front end.  But, while simple to do it still requires someone to write and that will take time.  And, the extra step adds complexity.&lt;BR /&gt;&lt;BR /&gt;NIS already has the scripts to index things like the password file, the hosts file, email aliases, etc., so it isn't like your starting from stratch.  You only have to make copies and then modify your copies to slice and dice your configuration file appropriately for your application.&lt;BR /&gt;&lt;BR /&gt;Not only will indexing make your application run faster but by properly organizing your data, it will be simplier to write and therefore, easier to maintain also.</description>
      <pubDate>Fri, 20 Jun 2003 20:08:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003698#M126996</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-06-20T20:08:48Z</dc:date>
    </item>
    <item>
      <title>Re: Create a lookup file or an array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003699#M126997</link>
      <description>the fastest way to do lookups in perl is to use hashes.&lt;BR /&gt;&lt;BR /&gt;%oncall_person ( manager -&amp;gt; 1232342424,&lt;BR /&gt;                  test -&amp;gt; 32323,&lt;BR /&gt;                  amen -&amp;gt; 666 ),&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;this will always remain in memory - fastest way to lookup - lookup tables.</description>
      <pubDate>Sat, 21 Jun 2003 01:20:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003699#M126997</guid>
      <dc:creator>Donny Jekels</dc:creator>
      <dc:date>2003-06-21T01:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: Create a lookup file or an array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003700#M126998</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;Thanks for all the helpful feedback. I will be using a shell script to search for the entry in the config file as I do not know perl as well as shell scripting. Its another thing to put on my long list of things to learn!!&lt;BR /&gt;&lt;BR /&gt;Curt, I do not have any experience with NIS, so I was wondering if you could elaborate on how NIS uses index files and then checks the config file so I can then decide if it is a better solution.&lt;BR /&gt;&lt;BR /&gt;Thanks again to everyone for their input.&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Sat, 21 Jun 2003 15:36:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003700#M126998</guid>
      <dc:creator>James Andertom</dc:creator>
      <dc:date>2003-06-21T15:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: Create a lookup file or an array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003701#M126999</link>
      <description />
      <pubDate>Sat, 21 Jun 2003 21:22:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003701#M126999</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-06-21T21:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: Create a lookup file or an array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003702#M127000</link>
      <description>some more urls for you:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://thor.prohosting.com/~nupshot21/perl/perl_dbm.shtml#DBM005C" target="_blank"&gt;http://thor.prohosting.com/~nupshot21/perl/perl_dbm.shtml#DBM005C&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://adamspiers.org/computing/dbm/" target="_blank"&gt;http://adamspiers.org/computing/dbm/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.jlmeek.com/demo/hash.txt" target="_blank"&gt;http://www.jlmeek.com/demo/hash.txt&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;that should give you some examples to work with</description>
      <pubDate>Sat, 21 Jun 2003 22:16:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003702#M127000</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-06-21T22:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: Create a lookup file or an array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003703#M127001</link>
      <description>lets see if we can get a perl script for returning a key value.  I'm not a perl programmer either, so if those of your that are have suggestions, please give them&lt;BR /&gt;&lt;BR /&gt;#!/usr/local/bin/perl -w&lt;BR /&gt;#&lt;BR /&gt;# output the value of a key from a DBM&lt;BR /&gt;# database given the database name and key.&lt;BR /&gt;#&lt;BR /&gt;use Fcntl; &lt;BR /&gt;use NDBM_File;&lt;BR /&gt;&lt;BR /&gt;if ($#ARGV != 2) {&lt;BR /&gt; print "usage: $ARGV[0] databaseName keyValue\n";&lt;BR /&gt; exit 1;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;$dbName = $ARGV[1];&lt;BR /&gt;$key    = $ARGV[2];&lt;BR /&gt;&lt;BR /&gt;tie %hash, "NDBM_File", $dbName, O_RDONLY|O_EXCL, 0644; || &lt;BR /&gt;die "Cannot open database file, $dbName: $!\n"; &lt;BR /&gt;&lt;BR /&gt;$value = $hash{$key}; &lt;BR /&gt;if (!defined($value)) { &lt;BR /&gt;print "$key not stored\n";&lt;BR /&gt;exit 2; &lt;BR /&gt;} else { &lt;BR /&gt;print "$value\n"; &lt;BR /&gt;} &lt;BR /&gt;&lt;BR /&gt;untie %hash; &lt;BR /&gt;exit 0;&lt;BR /&gt;&lt;BR /&gt;that should be a good start on a perl script for returning a value from a DBM database given the database name and key.</description>
      <pubDate>Sun, 22 Jun 2003 16:42:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/create-a-lookup-file-or-an-array/m-p/3003703#M127001</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-06-22T16:42:37Z</dc:date>
    </item>
  </channel>
</rss>

