jcg3525 has asked for the wisdom of the Perl Monks concerning the following question:
I'd be grateful for help in solving this little problem. I'm trying to convert a large body of ASCII text to delimited text (50 mgb).
Each item of text is currently formatted as follows (there are about 20k of these that need to be converted):
^46004 % Tamerlane.| Tamerlane - Sheridan; Bajazet - Barry; Moneses - A Gentleman; Arpasia - Mrs. Furnival; Selima - Mrs. Elmy; +
I would like it to look like this (but w/o double spacing) for importation into a database:
"46004","Tamerlane","Tamerlane","Sheridan"
"46004","Tamerlane","Bajazet","Barry"
"46004","Tamerlane","Moneses","A Gentleman"
"46004","Tamerlane","Arpasia","Mrs. Furnival"
"46004","Tamerlane","Selima","Mrs. Elmy"
Here's another example of the sort of text:
^46005 % Hamlet.| Hamlet - Sheridan; Polonius - J. Morris; Laertes- Lacy; Ophelia- Mrs. Storer; Queen - Mrs. Furnival; +
Changed to:
"46005","Hamlet","Hamlet","Sheridan"
"46005","Hamlet","Polonius ","J. Morris"
"46005","Hamlet","Laertes","Lacy"
"46005","Hamlet","Ophelia","Mrs. Storer"
"46005","Hamlet","Queen","Mrs. Furnival"
Any help gratefully acknowledged.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help formatting text to delimited text in file (updated)
by AnomalousMonk (Archbishop) on Apr 21, 2019 at 03:18 UTC | |
|
Re: Help formatting text to delimited text in file
by holli (Abbot) on Apr 20, 2019 at 23:25 UTC | |
by AnomalousMonk (Archbishop) on Apr 21, 2019 at 22:31 UTC | |
by Marshall (Canon) on Apr 21, 2019 at 21:30 UTC | |
|
Re: Help formatting text to delimited text in file
by jwkrahn (Abbot) on Apr 21, 2019 at 00:26 UTC | |
|
Re: Help formatting text to delimited text in file
by LanX (Saint) on Apr 20, 2019 at 22:14 UTC | |
|
Re: Help formatting text to delimited text in file
by Marshall (Canon) on Apr 21, 2019 at 19:01 UTC | |
|
Re: Help formatting text to delimited text in file
by clueless newbie (Curate) on Apr 21, 2019 at 15:44 UTC |