abitkin has asked for the wisdom of the Perl Monks concerning the following question:
So the idea is this, I use fortune for a number of things; however there is an annoyance. The people who wrote the fortunes put newlines in for wrapping and such. Normally this wouldn't be a problem, if I was using fortune in a terminal, but in this case, it's a resizable window. So newlines within a quote should be removed, but others should stay.
So, to make this easier to explain I ran my fortune command a number of times and seperated the quotes by a line of "=". I then made a copy of it and corrected it by hand. The goal is to have a perl script do it for me.
Original Text:
Bender: Stay away from our women. You got metal fever, baby, metal fe +ver! =================================================================== Kids, kids, kids. As far as Daddy's concerned, you're both potential murderers. -- Homer Simpson Who Shot Mr. Burns? (Part 2) =================================================================== Wh ... what's going on? Wh ... wha ... why am I on a Japanese box? -- Homer Simpson In Marge We Trust =================================================================== Who spread garbage all over Flanders's yard before I got a chance to? -- Homer Simpson Two Dozen and One Greyhounds =================================================================== THIS IS NOT A CLUE...OR IS IT? THIS IS NOT A CLUE...OR IS IT? THIS IS NOT A CLUE...OR IS IT? THIS IS NOT A CLUE...OR IS IT? Bart Simpson on chalkboard in episode 2F16 =================================================================== "It was nice of you to let me reattach your arm." --Zoidber =================================================================== Calculon: An Oscar, you say? That would get me out of this festering rats' nest called television once and for all. =================================================================== Dasher, Dancer ... Prancer ... Nixon, Comet, Cupid ... Donna Dixon. -- Homer Simpson Simpsons Roasting on an Open Fire =================================================================== Homer: I suppose you want to probe me. Well, you might as well get it over with. Kang: Stop! We have reached the limits of what rectal probing can teach us. Treehouse of Horror VII Famous Original Ray's Superior Court =================================================================== It's okay, Marge. I've learned my lesson. A mountain of sugar is too much for one man. It's clear now why God portions it out in those tiny packets, and why he lives on a plantation in Hawaii. -- Homer Simpson Lisa's Rival =================================================================== Bender: "Tell the Donbot I'm quitting organized crime. From now on I'l +l stick to the regular kind." =================================================================== "Hurry up! I wanna see the moon." -Fry "Relax. It's open 'till nine." -Leela =================================================================== I WILL NOT SCREAM FOR ICE CREAM I WILL NOT SCREAM FOR ICE CREAM I WILL NOT SCREAM FOR ICE CREAM I WILL NOT SCREAM FOR ICE CREAM Bart Simpson on chalkboard in episode AABF03 =================================================================== Calculon: I'm programmed to be very busy. =================================================================== "I don't care how many eyes a man has... as long as it's less than fi +ve." -Leela
Fixed Text:
Bender: Stay away from our women. You got metal fever, baby, metal fe +ver! =================================================================== Kids, kids, kids. As far as Daddy's concerned, you're both potential +murderers. -- Homer Simpson Who Shot Mr. Burns? (Part 2) =================================================================== Wh ... what's going on? Wh ... wha ... why am I on a Japanese box? -- Homer Simpson In Marge We Trust =================================================================== Who spread garbage all over Flanders's yard before I got a chance to? -- Homer Simpson Two Dozen and One Greyhounds =================================================================== THIS IS NOT A CLUE...OR IS IT? THIS IS NOT A CLUE...OR IS IT? THIS IS NOT A CLUE...OR IS IT? THIS IS NOT A CLUE...OR IS IT? Bart Simpson on chalkboard in episode 2F16 =================================================================== "It was nice of you to let me reattach your arm." --Zoidber =================================================================== Calculon: An Oscar, you say? That would get me out of this festering +rats' nest called television once and for all. =================================================================== Dasher, Dancer ... Prancer ... Nixon, Comet, Cupid ... Donna Dixon. -- Homer Simpson Simpsons Roasting on an Open Fire =================================================================== Homer: I suppose you want to probe me. Well, you might as well get + it over with. Kang: Stop! We have reached the limits of what rectal probing can +teach us. Treehouse of Horror VII Famous Original Ray's Superior Court =================================================================== It's okay, Marge. I've learned my lesson. A mountain of sugar is too + much for one man. It's clear now why God portions it out in those t +iny packets, and why he lives on a plantation in Hawaii. -- Homer Simpson Lisa's Rival =================================================================== Bender: "Tell the Donbot I'm quitting organized crime. From now on I'l +l stick to the regular kind." =================================================================== "Hurry up! I wanna see the moon." -Fry "Relax. It's open 'till nine." -Leela =================================================================== I WILL NOT SCREAM FOR ICE CREAM I WILL NOT SCREAM FOR ICE CREAM I WILL NOT SCREAM FOR ICE CREAM I WILL NOT SCREAM FOR ICE CREAM Bart Simpson on chalkboard in episode AABF03 =================================================================== Calculon: I'm programmed to be very busy. =================================================================== "I don't care how many eyes a man has... as long as it's less than fi +ve." -Leela
Something to remember, not only spaces are used, but also tabs, so be aware of that.
There are really only a couple of tasks here:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Removing Preformatted Word Wrapping
by ikegami (Patriarch) on Oct 12, 2004 at 15:00 UTC | |
by ikegami (Patriarch) on Oct 12, 2004 at 18:25 UTC | |
by abitkin (Monk) on Oct 12, 2004 at 19:58 UTC | |
|
Re: Removing Preformatted Word Wrapping
by ccn (Vicar) on Oct 12, 2004 at 15:03 UTC | |
|
Re: Removing Preformatted Word Wrapping
by ccn (Vicar) on Oct 13, 2004 at 07:31 UTC |