\root\sandeep\log111.txt
This files has a lot of text and one particulr line is .....
##Date 24-07-2001
Now
1. I need to locate the line "##Date" in the above file
2. I then need to store the date value "24-07.2001" in a variable.
Which language you are using? I assume Perl, because this is much simpler in
Perl.
1. Open the file for reading.
2. Search for the above string by reading every line. $_ variable
contains the current line. You can do this by using pattern searching
operations in Perl.
3. Once you find the above line then split that line at spaces and collect
the required date in a variable.
Here is the code which I would prefer to write.
open(RH,"</root/sandeep/log111.txt");
while(<RH>)
{
if($_ =~ /##Date/)
{
$flag = 1;
}
else
{
$flag = 0;
}
if($flag eq 1)
{
($str1, $str2) = split(/ /, $_);
$date = $str2;
}
}
Hope this is very much clear.
Regards,
Mayur
_________________________________________________________________
Get your FREE download of MSN Explorer at
http://explorer.msn.com/intl.asp