- Apr 20, 2000
- 1,255
- 0
- 76
and I have no programming experience at all, so any help would be appreciated.
I am not sure how to post code on fusetalk so I shall post here and be bashed for the formatting and take suggestions after the fact.
while ($line = <FIL>)
{
chop $line;
# 1/14/04 12:32 AM 124 <A HREF="/data/123072.txt">123072.txt</A><br>
#1/15/04 1:59 AM 6572 <A HREF="/data/123097.txt">123097.txt</A><br>
if($line =~ /(\d{1,2})\/(\d{1,2})\/(\d{2})\s+(\d{1,2})
\d{1,2})\s(\w{2})\s+(\d+) </)
{
#print "MATCH: \n";
if($6 eq 'PM' && $4 < 12) {
$mil_hour = $4 + 12; # i.e. 12:55 PM = 12:55 while 11:55 PM = 23:55
} elsif($6 eq 'AM' && $4 == 12) {
$mil_hour = $4 - 12; # i.e. 12:55 AM = 00:55
} else {
$mil_hour = $4;
}
$date_stamp = sprintf("20%02d%02d%02d%02d%02d", $3,$1,$2,$mil_hour,$5); # YYYYMMDDhhmm
$day_stamp = sprintf("20%02d%02d%02d", $3,$1,$2); # YYYYMMDD
$filesize = $7;
}
if($DEBUG_MODE > 1)
{
printf "D: $date_stamp,$day_stamp,$filesize\n"; # First 2 lines is just html and won't match regexp above
}
# CHECK if this feed is old, or valid for this reset (it should never be == as news don't really start till day 2/3)
if($day_stamp >= $reset_start)
{
if($line =~ /(\d{6}\.txt)/)
{
#print "Bingo!\n";
$feed = $1;
I am sure it has to do with with regex at the top but then that will also affect the variables,
I think they are called, the $1, $2, $3. Since the format that the site that the script gets the info from from has changed the way they store the date format,
Thursday, November 13, 2008 11:00 PM 496 <A HREF="/data/165455.txt">165455.txt</A><br>
Thanks for any help
danzigrules
I am not sure how to post code on fusetalk so I shall post here and be bashed for the formatting and take suggestions after the fact.
while ($line = <FIL>)
{
chop $line;
# 1/14/04 12:32 AM 124 <A HREF="/data/123072.txt">123072.txt</A><br>
#1/15/04 1:59 AM 6572 <A HREF="/data/123097.txt">123097.txt</A><br>
if($line =~ /(\d{1,2})\/(\d{1,2})\/(\d{2})\s+(\d{1,2})
{
#print "MATCH: \n";
if($6 eq 'PM' && $4 < 12) {
$mil_hour = $4 + 12; # i.e. 12:55 PM = 12:55 while 11:55 PM = 23:55
} elsif($6 eq 'AM' && $4 == 12) {
$mil_hour = $4 - 12; # i.e. 12:55 AM = 00:55
} else {
$mil_hour = $4;
}
$date_stamp = sprintf("20%02d%02d%02d%02d%02d", $3,$1,$2,$mil_hour,$5); # YYYYMMDDhhmm
$day_stamp = sprintf("20%02d%02d%02d", $3,$1,$2); # YYYYMMDD
$filesize = $7;
}
if($DEBUG_MODE > 1)
{
printf "D: $date_stamp,$day_stamp,$filesize\n"; # First 2 lines is just html and won't match regexp above
}
# CHECK if this feed is old, or valid for this reset (it should never be == as news don't really start till day 2/3)
if($day_stamp >= $reset_start)
{
if($line =~ /(\d{6}\.txt)/)
{
#print "Bingo!\n";
$feed = $1;
I am sure it has to do with with regex at the top but then that will also affect the variables,
I think they are called, the $1, $2, $3. Since the format that the site that the script gets the info from from has changed the way they store the date format,
Thursday, November 13, 2008 11:00 PM 496 <A HREF="/data/165455.txt">165455.txt</A><br>
Thanks for any help
danzigrules
