in reply to Re^2: Text file processing question
in thread Text file processing question
I now have to get down to the business of understanding the regular expression.
There's not much to it really. Essentially the input file consists of 5 groups of non-whitespace characters interpersed with whitespace.
The only fly in that ointment is the 4th field which itself contains whitepace, and so prevents trival parsing with split. Luckily, as only one field contains multiple words, we can let the regex engine sort it out for us. Ask it for the first 3 whitespace delimited fields, and the last one. And the fourth field is everything left over.
You might find it clearer expanded out like this:
m[ ( \S+ ) \s+ ( \S+ ) \s+ ( \S+ ) \s+ ( .+ ) \s+ ( \S+ ) $ ]x
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Text file processing question
by perl_seeker (Scribe) on Dec 09, 2009 at 11:07 UTC | |
by BrowserUk (Patriarch) on Dec 09, 2009 at 12:45 UTC | |
by perl_seeker (Scribe) on Dec 15, 2009 at 07:48 UTC | |
by perl_seeker (Scribe) on Dec 21, 2009 at 10:21 UTC | |
by BrowserUk (Patriarch) on Dec 21, 2009 at 11:33 UTC | |
by perl_seeker (Scribe) on Dec 22, 2009 at 09:31 UTC | |
by perl_seeker (Scribe) on Jan 11, 2010 at 11:50 UTC | |
|