in reply to Re: Append Next Line To Current Line
in thread Append Next Line To Current Line
I should have posted more code. Here is my complete code:
open(FH, "error_log:); @data = <FH> foreach $line (@data) { if ( ($line =~ /notice/)) { $line =~ s/ /,/g; my @L1 = split(/|notice|\[|\]|,mpmstats:,|\t|rdy,|bsy, +|rd,|wr,|ka,|log,|dns,|cls,|bsy:,|in,|/, $line); $line =~ s/|notice|\[|\]|,mpmstats:,|\t|rdy,|bsy,|rd,| +wr,|ka,|log,|dns,|cls,|bsy:,|in,//g; print $line;
Note that I printed only to see the output. Output is the following:
Wed,Jun,13,10:40:35,2012,758,42,0,29,11,0,0,2 Wed,Jun,13,10:40:35,2012,29,mod_was_ap22_http.c Wed,Jun,13,10:41:35,2012,761,39,0,34,5,0,0,0 Wed,Jun,13,10:41:35,2012,34,mod_was_ap22_http.c Wed,Jun,13,10:42:35,2012,769,31,0,22,6,0,0,3 Wed,Jun,13,10:42:35,2012,22,mod_was_ap22_http.c Wed,Jun,13,10:43:35,2012,754,46,0,29,17,0,0,0
I would like the number (42) placed in csv form after the others on the first line corresponding to the timestamp. If the line has nothing below (ex. last line) I would like to input a zero. Thank you for your help.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Append Next Line To Current Line
by Ransom (Beadle) on Jul 02, 2012 at 18:24 UTC | |
by johngg (Canon) on Jul 02, 2012 at 19:16 UTC | |
by Ransom (Beadle) on Jul 02, 2012 at 19:22 UTC | |
|
Re^3: Append Next Line To Current Line
by Anonymous Monk on Jul 02, 2012 at 18:00 UTC |