PerlReader has asked for the wisdom of the Perl Monks concerning the following question:
I've had difficulty peeling data from a flat file. I initially thought I could terminal line grep it, but it urped all over the very long lines and Perl is more flexible anyway if I need to add functions later. The information I'm seeking uses some reserved characters that need to be escaped in grep.
Here's what I'm trying to do:
1. Open a text file with a mucky-thick block of text (almost no line feeds).
2. Search for occurrences of a string that begins with -/ (dash slash) that variably contains between 5 and 20 alphanumeric characters and which ends with ?srt= (question mark srt equals).
Here are examples:
3. Write the alphanumeric strings to a text file, each occurrence on a new line.
Thanks for your accumulated (and accumulating) wisdom.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Peeling Data with Reserved Characters and Long Lines
by davido (Cardinal) on Mar 12, 2011 at 09:40 UTC | |
by roboticus (Chancellor) on Mar 12, 2011 at 13:03 UTC | |
|
Re: Peeling Data with Reserved Characters and Long Lines
by Eliya (Vicar) on Mar 12, 2011 at 09:37 UTC | |
|
Re: Peeling Data with Reserved Characters and Long Lines
by JavaFan (Canon) on Mar 12, 2011 at 12:48 UTC | |
|
Re: Peeling Data with Reserved Characters and Long Lines
by PerlReader (Initiate) on Mar 12, 2011 at 16:00 UTC | |
by Eliya (Vicar) on Mar 12, 2011 at 20:18 UTC | |
|
Re: Peeling Data with Reserved Characters and Long Lines
by PerlReader (Initiate) on Mar 13, 2011 at 00:23 UTC | |
by Eliya (Vicar) on Mar 13, 2011 at 01:48 UTC |