Please show some of the real data, there might be a clue in it to help figure out a rule to use to split the lines up correctly. By what you posted it looks like you could use the field "names" (ab, bc, dc) to help split the fields up correctly, but I have a feeling that is psuedo data, not real data.
What kind of log file is this? There might already be a module written that understands the log format.
Anyways, for the lines with no forward slash in the values:
#!/bin/perl
use strict;
use warnings;
my $LOGFILE = "/path/to/logfile/filename.txt";
open(LOGFILE, $LOGFILE) or die "Could not open log file :$!";
while (<LOGFILE>) {
chomp;
my @fields = split(/\//);
s/^\(\d*?\)// for @fields;
print "$_\n" for @fields;
}
close(LOGFILE);
The data is just records of users accessing data. I don't think there is existing modules for this data as it is very specific for this log and not generally used.
the fields could have e.g. mt=image/gif (media type downloaded, could be any mime type really...)
Also there is field for browser type e.g. "bt=Mozilla/4"
Which tells the time of access to media (at) the content size (cs) media type (mt) and browser that was used to access the content (bt). There is about 100 different field names and they all are 2 letter combinations followed by "=" and then the value ending with the field separator "/", which I btw can't unfortunately change.
Maybe the data could be split somehow with the fieldnames like KevinADC suggested.
#!/bin/perl
use strict;
use warnings;
my $LOGFILE = "/path/to/logfile/filename.txt";
open(LOGFILE, $LOGFILE) or die "Could not open log file :$!";
while (<LOGFILE>) {
chomp;
s/\(\d+\)//g; # remove the (n) part
s#/([a-z]{2}=)#:::$1#g; # convert delimiter to :::
my @fields = split(/:::/); #split using new delimiter
print "$_\n" for @fields;
}
close(LOGFILE);
Probably someone better with regexps can write something shorter and possibly more efficient using zero-width look ahead/behind assertions, which I am not too good with.