nanouk has asked for the wisdom of the Perl Monks concerning the following question:
Oct 1 13:23:25 smoothwall-swe3 kernel: Allocating PCI resources starting at 10000000 (gap: 08000000:f6c00000) Oct 1 13:23:25 smoothwall-swe3 kernel: Built 1 zonelists Oct 1 13:23:25 smoothwall-swe3 kernel: Kernel command line: BOOT_IMAGE=SmoothWall ro root=804 ramdisk_size=8192 no-scroll panic=30 Oct 1 13:23:25 smoothwall-swe3 kernel: Enabling fast FPU save and restore... done. Oct 1 13:23:25 smoothwall-swe3 smoothd: Loading Plugins for Module "/usr/lib/smoothd/sysinstall.so
It just replaces the first occurrence, after the leading Oct. Any help would be greatly appreciated, since googleing has proved rather frustrating. TIA#!/usr/bin/perl open (FILE,"</var/log/messages") || die 'Unable to open log file'; open (TMP, ">/tmp/messages.csv") || die 'Unable to write to file'; while (<FILE>) { $_ =~ s/\s{1,6}/,/; print TMP $_; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl substitution difficulty
by graff (Chancellor) on Oct 15, 2007 at 12:11 UTC | |
by Somni (Friar) on Oct 15, 2007 at 12:24 UTC | |
by svenXY (Deacon) on Oct 15, 2007 at 12:30 UTC | |
by svenXY (Deacon) on Oct 15, 2007 at 12:20 UTC | |
|
Re: perl substitution difficulty
by McDarren (Abbot) on Oct 15, 2007 at 12:32 UTC | |
|
Re: perl substitution difficulty
by svenXY (Deacon) on Oct 15, 2007 at 12:12 UTC | |
|
Re: perl substitution difficulty
by moritz (Cardinal) on Oct 15, 2007 at 12:16 UTC | |
|
Re: perl substitution difficulty
by Krambambuli (Curate) on Oct 15, 2007 at 12:31 UTC | |
|
Re: perl substitution difficulty
by svenXY (Deacon) on Oct 15, 2007 at 12:14 UTC |