Page 1 of 1

Make Paragraphs

Posted: Mon Mar 22, 2010 3:58 pm
by pakiyabhai
I have used textsoap on mac , with a feature which gives the option of make paragraph from the text below , there are extra spaces as you can see from the body of the text. I cannot find anything like this in Remove menu .






South African White Corn Falls as Rand Gains Against Dollar



By Mkhululi Mancotywa
March 15 (Bloomberg) -- White corn in South Africa, the
largest producer of the grain on the continent, fell as the rand
rose, cutting the cost of imports for local millers.
The rand traded at 7.3994 against the dollar at 9:25 a.m.
in Johannesburg, compared with 7.4015 at the close of trading at
noon March 12.

Re: Make Paragraphs

Posted: Mon Mar 22, 2010 10:12 pm
by AnthonyFitz
Hi pakiyabhai,

I think this is something that could be done in TextPipe.

What do you want to do exactly? Can you post the output of the text you would like to see.

Anthony.

Re: Make Paragraphs

Posted: Mon Mar 22, 2010 10:32 pm
by pakiyabhai
From

Code: Select all

 
South African White Corn Falls as Rand Gains Against Dollar



By Mkhululi Mancotywa
March 15 (Bloomberg) -- White corn in South Africa, the
largest producer of the grain on the continent, fell as the rand
rose, cutting the cost of imports for local millers.
The rand traded at 7.3994 against the dollar at 9:25 a.m.
in Johannesburg, compared with 7.4015 at the close of trading at
noon March 12.

To

Code: Select all

South African White Corn Falls as Rand Gains Against Dollar By Mkhululi Mancotywa March 15 (Bloomberg) -- White corn in South Africa, the largest producer of the grain on the continent, fell as the rand rose, cutting the cost of imports for local millers. The rand traded at 7.3994 against the dollar at 9:25 a.m.in Johannesburg, compared with 7.4015 at the close of trading at noon March 12.

Re: Make Paragraphs

Posted: Tue Mar 23, 2010 9:11 am
by DataMystic Support
Use an EasyPattern like this, to replace runs of spaces tabs and line breaks with a single space.

Code: Select all

[ longest 1+ (space or tab or cr or lf) ]
ie

Code: Select all

EasyPattern [[ longest 1+ (space or tab or cr or lf) ]] with [ ]
   [ ] Match case
   [ ] Whole words only
   [ ] Case sensitive replace
   [X] Prompt on replace
   [ ] Skip prompt if identical
   [ ] First only
   [ ] Extract matches
   Maximum text buffer size 4096

Re: Make Paragraphs

Posted: Tue Mar 23, 2010 3:58 pm
by pakiyabhai
hanks for the reply , you were close but something did go wrong , the output comes with no space at all now , something like . I did precisely what you asked me to used a replace filter with easy pattern.

Code: Select all

SouthAfricanWhiteCornFallsasRandGainsAgainstDollarByMkhululiMancotywaMarch15(Bloomberg)--WhitecorninSouthAfrica,thelargestproducerofthegrainonthecontinent,fellastherandrose,cuttingthecostofimportsforlocalmillers.Therandtradedat7.3994againstthedollarat9:25a.m.inJohannesburg,comparedwith7.4015atthecloseoftradingatnoonMarch12.
Update , in replace column i entered one single space and it worked.

Can you tell me whta does cr or lf mean & what would the perl equivalent of this command be ?

Re: Make Paragraphs

Posted: Tue Mar 23, 2010 4:25 pm
by DataMystic Support
Glad you realized you had missed the space in the replacement!

CR is a carriage return. LF is a line feed. TextPipe hides these details for you - you don't need to know the technical details at all when you use EasyPatterns in TextPipe.

Re: Make Paragraphs

Posted: Mon Mar 29, 2010 5:10 pm
by Raresed84
thanks for this post...it was time to fix this problem:)

Re: Make Paragraphs

Posted: Mon Apr 26, 2010 5:02 pm
by pakiyabhai
there is a small error which I am facing with this now .

This seems to remove ALL the spaces between the paragraphs as well and my news becomes one long string.

Can I modify this to respects paragraphs or maybe 2 spaces ?

Re: Make Paragraphs

Posted: Tue Apr 27, 2010 9:26 am
by DataMystic Support
PLease attach the filter as a zip file, with sample text in the Trial Run area.