M
mike
hi
i have a log file with contents like (separate by | ):
19Jan2004| 0:00:45||log|accept||eri0|inbound|tcp|||http|57135|48|74|||52509|http|||||
19Jan2004| 0:00:45||log|accept||eri0|inbound|tcp|||http|4386|48|11|||4386|http|||||
19Jan2004| 0:00:45||log|accept||eri0|inbound|tcp|||http|4387|48|11|||4387|http|||||
I wrote a perl script to split the fields according to "|"
....
while ( <FILE> )
{
chomp($_);
my @lines = split(/|/ , $_ );
print "The lines are : @lines\n";
}
close(FILE);
....
The results are:
The lines are : 1 9 J a n 2 0 0 4 | 0 : 0 0 : 4 5 | | l o g | a c c
e p t | | q f e 2 | i n b o u n d | t c p | | | h t t p | 5 7 1 3 5 |
4 8 | 7 4 | | | 5 2 5 0 9 | h t t p | | | | |
The lines are : 1 9 J a n 2 0 0 4 | 0 : 0 0 : 4 5 | | l o g | a c c
e p t | | q f e 1 | i n b o u n d | t c p | | | h t t p | 4 3 8 6 | 4
8 | 1 1 | | | 4 3 8 6 | h t t p | | | | |
The lines are : 1 9 J a n 2 0 0 4 | 0 : 0 0 : 4 5 | | l o g | a c c
e p t | | q f e 1 | i n b o u n d | t c p | | | h t t p | 4 3 8 7 | 4
8 | 1 1 | | | 4 3 8 7 | h t t p | | | | |
"Split" did not split the fields up.. what is wrong with my code.
thanks
i have a log file with contents like (separate by | ):
19Jan2004| 0:00:45||log|accept||eri0|inbound|tcp|||http|57135|48|74|||52509|http|||||
19Jan2004| 0:00:45||log|accept||eri0|inbound|tcp|||http|4386|48|11|||4386|http|||||
19Jan2004| 0:00:45||log|accept||eri0|inbound|tcp|||http|4387|48|11|||4387|http|||||
I wrote a perl script to split the fields according to "|"
....
while ( <FILE> )
{
chomp($_);
my @lines = split(/|/ , $_ );
print "The lines are : @lines\n";
}
close(FILE);
....
The results are:
The lines are : 1 9 J a n 2 0 0 4 | 0 : 0 0 : 4 5 | | l o g | a c c
e p t | | q f e 2 | i n b o u n d | t c p | | | h t t p | 5 7 1 3 5 |
4 8 | 7 4 | | | 5 2 5 0 9 | h t t p | | | | |
The lines are : 1 9 J a n 2 0 0 4 | 0 : 0 0 : 4 5 | | l o g | a c c
e p t | | q f e 1 | i n b o u n d | t c p | | | h t t p | 4 3 8 6 | 4
8 | 1 1 | | | 4 3 8 6 | h t t p | | | | |
The lines are : 1 9 J a n 2 0 0 4 | 0 : 0 0 : 4 5 | | l o g | a c c
e p t | | q f e 1 | i n b o u n d | t c p | | | h t t p | 4 3 8 7 | 4
8 | 1 1 | | | 4 3 8 7 | h t t p | | | | |
"Split" did not split the fields up.. what is wrong with my code.
thanks