Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
And I want to replace it withJanuary 1, 1915 Franck Pourcel January 3, 1926 George Martin January 3, 1945 Stephen Stills January 3, 1946 John Paul Jones January 4, 1942 John McLaughlin January 5, 1950 Chris Stein
Sometimes the spaces after the year are less or more.January 1, 1915 (Birthday) Franck Pourcel - singer January 3, 1926 (Birthday) George Martin - singer January 3, 1945 (Birthday) Stephen Stills - singer January 3, 1946 (Birthday) John Paul Jones - singer January 4, 1942 (Birthday) John McLaughlin - singer January 5, 1950 (Birthday) Chris Stein - singer
This is what I got so far.
I think I need some help.#!/usr/bin/perl use warnings; use strict; open(LOG, "source.txt") or die "error"; my @lines = <LOG>; close(LOG); my $cnt = 0; foreach my $line (@lines) { $cnt++; $line =~ s/(\d+\s+)(.+)/$1 }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: small regex help
by Zaxo (Archbishop) on Jun 17, 2006 at 00:37 UTC | |
|
Re: small regex help
by GrandFather (Saint) on Jun 17, 2006 at 00:44 UTC | |
|
Re: small regex help
by swampyankee (Parson) on Jun 17, 2006 at 01:05 UTC | |
|
Re: small regex help
by sulfericacid (Deacon) on Jun 17, 2006 at 00:35 UTC | |
|
Re: small regex help
by sh1tn (Priest) on Jun 17, 2006 at 14:17 UTC |