Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Accessing /usr/adm/binary.errlog from Perl
@ 1997-11-17  5:00 stockman
  1997-11-18  5:00 ` Mathias-H. Weber
  0 siblings, 1 reply; 2+ messages in thread
From: stockman @ 1997-11-17  5:00 UTC (permalink / raw)
  To: stockman


Hello,

 Using DU 4.0B and Perl5.004_04.

 I will be posting to the perl newsgroup also.

 I am trying to learn Perl and am trying to access
a filed called /usr/adm/binary.errlog. The file
has bootup information that is retrevied via
uerf -R. What I am wanting to do is write a Perl
script that will extract information from that
file and display it in a SGI hinv type of format.

 The SGI hinv command displays information about the
system such as OS Version, disk drives and their SCSI
ID, graphics device and etc.. This binary.errlog has
most of the information that I need. I am just having
trouble accessing it. Has anyone written or accessed this
file via Perl before ?? Has anyone written anything along
this line before ?? If so - care to share it ??

 Can someone provide an example of how to access this
file from perl ?? This is what I am doing thus far, but
none of the records are being printed. Just a first start
to make sure that I can get at the information.

#!/usr/local/bin/perl
$file1 = "/usr/adm/binary.errlog";
$size = -s $file1;      # remember how big this file is


print STDERR "$file1 is $size bytes long\n";

die "\a$file1 does not exist or has no data\n" unless $size;
open (IN, $file1) || die "Can't open $file1, $!\n";
while (<IN>) {
   print "REC $IN \n";
}

close (IN) || die "Can't close $file1, $!\n";


 Thanks,

 Gaylon Stockman

 stockman@rdbewss.redstone.army.mil

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Accessing /usr/adm/binary.errlog from Perl
  1997-11-17  5:00 Accessing /usr/adm/binary.errlog from Perl stockman
@ 1997-11-18  5:00 ` Mathias-H. Weber
  0 siblings, 0 replies; 2+ messages in thread
From: Mathias-H. Weber @ 1997-11-18  5:00 UTC (permalink / raw)



Hi,
stockman@rdbewss.redstone.army.mil wrote:
> 
> Hello,
> 
>  Using DU 4.0B and Perl5.004_04.

sorry, but for me as an SGI user it took a while to identify DU 
as Digital Unix (am I right?). 

> 
>  I will be posting to the perl newsgroup also.
> 
>  I am trying to learn Perl and am trying to access

                  ^^^^^^^^^^ A good idea!

> a filed called /usr/adm/binary.errlog. The file
> has bootup information that is retrevied via
> uerf -R. What I am wanting to do is write a Perl
> script that will extract information from that
> file and display it in a SGI hinv type of format.
> 

The usually file has only read permissions for user "root" and 
group "adm" (or "system"). Maybe this is your (first?) problem: if 
you run your perls script as a normal (mortal) user you cannot access
the log file for reading.

> 
> #!/usr/local/bin/perl
> $file1 = "/usr/adm/binary.errlog";
> $size = -s $file1;      # remember how big this file is
> 
> print STDERR "$file1 is $size bytes long\n";
> 
> die "\a$file1 does not exist or has no data\n" unless $size;
> open (IN, $file1) || die "Can't open $file1, $!\n";
> while (<IN>) {
>    print "REC $IN \n";

Okay, you print each "line" of the file. But I am not sure, whether
this file is organized in lines at all. I haven't found the 
description of the file format in a quick search. But the man pages
provide a good source to explore further. Also have a look at the man 
pages concerning the perl built-in function "pack". If the data in the
file are some kind of binary nature this could be a help.

> }
> 
> close (IN) || die "Can't close $file1, $!\n";
> 
>  Thanks,
> 
>  Gaylon Stockman
> 
>  stockman@rdbewss.redstone.army.mil
> 


Good luck,
Mathias

-- 
__________________________________________________________________
| Dr. Mathias-H. Weber          ---     mailto:mweber@atlas.de   |
| STN ATLAS ELEKTRONIK GmbH   {~@_@~}                            |
| Brueggeweg 54 / Dept ETS21  _( Y )_   Phone:  +49 421 457 4401 |
| 28305 BREMEN               (:_~*~_:)  Fax  :  +49 421 457 3177 |
| Germany                     (_)-(_)   Telex:  2 457 460        |
___________________________SIGSIG: Signature too long (core dumped)



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-11-18  5:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-11-17  5:00 Accessing /usr/adm/binary.errlog from Perl stockman
1997-11-18  5:00 ` Mathias-H. Weber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox