Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Read Text out off File?

Status
Not open for further replies.

Roeckli

Technical User
Aug 3, 2002
14
NL
Hi

I've tried to get one word out off a file. I used the following script:

!/usr/bin/perl

print "Content-type: text/html\n\n";

use strict;

chomp(my $file=</home/drivestatus>);

open(FH, &quot;< $file&quot;) or die &quot;Blabla $file open\n&quot;;

undef $/;

my $search = <FH>;
if($search =~ m/drivestatus/) {

print &quot;drivestatus&quot; }

The problem I have is that the name *drivestatus can change any time and I dont know the new name :(.



Any Idea?

Thanks in advance

Daniel
daniel_giger@hotmail.com
 
Daniel, hi.

Ok.... So the word you're looking for might or might not be drivestatus.

What doesn't change? what's always around the word you're looking for? Mike
________________________________________________________________

&quot;Experience is the comb that Nature gives us, after we are bald.&quot;

Is that a haiku?
I never could get the hang
of writing those things.
 
Hi Mike,

online OR offline :)) it starts allways @point 15

..............drivestatus

there might be some options which are not on the same line as drivestatus.

drivestatus (or anything else) online/offline raid 5
spare 2

thats how it could look like (more or less :))

Thx for reply

Daniel


 
Danial,

Post a bit of the file you need to analyze, let's have a look. Mike
________________________________________________________________

&quot;Experience is the comb that Nature gives us, after we are bald.&quot;

Is that a haiku?
I never could get the hang
of writing those things.
 
Hi Mike,

It looks like this:

Volume State Status Options
test online normal raidsize=12
raidgroup=0
root online normal root
volume online normal raidsize=6

I'm only intrested in &quot;test,root and volume&quot;
I've tried to read only the first 15 lines but then I also get the Volume which I don't need
many thx

Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top