brassmon_k has asked for the wisdom of the Perl Monks concerning the following question:
All the lines look like this except different numbers etc... but the positions are the same. Now the 5th field $5 is the date of course and the $6 is the time.4478 00300 064 01 01/11/19 00:00:41 03 00000092a71228a9 255 01 00:00:3 +0 01 00 00 00 DID 0000000000000000 000 0000000000000000 0000000000000 +000 0000000000000000 000 61<BR>
Any Help would definately be appreciated.#!/usr/bin/perl print "DateSearch = d\n"; print "Timesearch = t\n"; print "Make Your Choice."; chomp($choice = STDIN); if ($choice =~ /d/) { chomp($date = STDIN); open(FILE, "/dave/MVPTEST/mvpdoc"); while (<FILE>) { @lines = split(/\n/, $_); foreach $lines (@lines) { if ($lines =~ /(\d{4})\s(\d{5})\s(\d{3})\s(\d{2})\s(\d{2}\/\d{2}\/\d{2 +})\s(\d{2}\:\d{2}\:\d{2})/) { if ($date =~ /$5/) { print "\n@lines\n"; } } } } } elsif ($choice =~ /t/) { chomp($time = STDIN); open(FILE, "/dave/MVPTEST/mvpdoc"); while (<FILE>) { @lines = split(/\n/, $_); foreach $lines (@lines) { if ($lines =~ /(\d{4})\s(\d{5})\s(\d{3})\s(\d{2})\s(\d{2}\/\d{2}\/\d{2 +})\s(\d{2}\:\d{2}\:\d{2})/) { if ($time =~ /$6/) { print "\n@lines\n"; } } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(Ovid) Re: Get number ranges from files internally?
by Ovid (Cardinal) on Dec 31, 2001 at 21:48 UTC | |
|
Re: Get number ranges from files internally?
by talexb (Chancellor) on Dec 31, 2001 at 21:44 UTC | |
|
Re: Get number ranges from files internally?
by jlongino (Parson) on Dec 31, 2001 at 21:51 UTC | |
by brassmon_k (Sexton) on Dec 31, 2001 at 23:21 UTC |