Hi Agnello,
On Monday 18 October 2010 15:01:56 Agnello George wrote:
> I know the problem is solved but Could the script be done like this ??
>
OK, I'll answer it.
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
>
> while (my $line = ) {
Why are you using *DATA and __DATA__ for the data
On Sat, Oct 16, 2010 at 2:11 PM, Shlomi Fish wrote:
> On Thursday 14 October 2010 16:54:32 yo RO wrote:
> > Hello I need to split a log file per days
> > I have a file in txt format and I want to create a file with all data
> > from one day in one file
> > I will give example
> >
> > I have this
I know the problem is solved but Could the script be done like this ??
#!/usr/bin/perl
use strict;
use warnings;
while (my $line = ) {
chomp($line);
my ($out_file) = $line =~ m/^(\d+_\d+_\d+);/;
open (WRT,">>$out_file.log" ) or die " cannot opne file:
$!";
On Oct 16, 10:41 am, shlo...@iglu.org.il (Shlomi Fish) wrote:
> On Thursday 14 October 2010 16:54:32 yo RO wrote:
>
>
>
> > Hello I need to split a log file per days
> > I have a file in txt format and I want to create a file with all data
> > from one day in one file
> > I will give example
>
> >
use strict;
use warnings;
my %log;
while(){
chomp;
my ($key, $value) = split /;/, $_;
push @{$log{$key}}, $value;
}
foreach my $k (keys %log){
open my $k_fh, '>', "$k.log" or die "Could not open the file - $k.log
: $! \n";
foreach my $v (@{$log{$k}}) {
print $k_f
On Thursday 14 October 2010 16:54:32 yo RO wrote:
> Hello I need to split a log file per days
> I have a file in txt format and I want to create a file with all data
> from one day in one file
> I will give example
>
> I have this imput
> 3_21_2010;11:12\\trafic info
> 3_21_2010;11:34\\trafic info
On Thu, Oct 14, 2010 at 4:54 PM, yo RO wrote:
> Hello I need to split a log file per days
> I have a file in txt format and I want to create a file with all data
> from one day in one file
> I will give example
>
> I have this imput
> 3_21_2010;11:12\\trafic info
> 3_21_2010;11:34\\trafic info
>
for using split, try to remove the ( ) since you will not be needing $1
through $9. I suspect because you have many ( ) in there, this might
cause a problem. I also gather that you are trying not to really split,
but to pattern match, in which case you can only have from $1-$9 (i
belive that is co