How can I trim all paragraph only leave a few line

Find, replace, find in files, replace in files, regular expressions

How can I trim all paragraph only leave a few line

Postby Cathy » Sat Jan 22, 2005 10:51 pm

How can I trim all paragraph only leave a few line. For example:

Code: Select all
   margin-bottom:.0001pt;
   mso-pagination:widow-orphan;
   font-size:12.0pt;
   font-family:"Times New Roman";
   mso-fareast-font-family:"Times New Roman";}
   span.MsoHyperlink
   {color:blue;
   text-decoration:underline;
   text-underline:single;}
                span.MsoHyperlinkFollowed
   {color:purple;
                margin-bottom:.0001pt;
   mso-pagination:widow-orphan;
   font-size:12.0pt;
   font-family:"Times New Roman";
   mso-fareast-font-family:"Times New Roman";}
   span.MsoHyperlink

                xxxxxxx

                aaaaaaa
                bbbbbbbb

                 

   {color:blue;
   text-decoration:underline;
   text-underline:single;}
                span.MsoHyperlinkFollowed
   {color:purple;


I want result like this
Code: Select all
                mso-pagination:widow-orphan;
                mso-fareast-font-family:"Times New Roman";}
                aaaaaaa
                bbbbbbbb


I want built a loop to search a long paragraph

Thanks
User avatar
Cathy
Newbie
 
Posts: 1
Joined: Sat Jan 22, 2005 12:00 am

Re: How can I trim all paragraph only leave a few line

Postby Mofi » Sun Jun 25, 2006 11:25 am

Following macro will do this reformat. The cursor must be placed at start of the paragraph. This macro was created by simply recording a manual reformat.

InsertMode
ColumnModeOff
HexOff
UnixReOff
Clipboard 9
StartSelect
Find Select "mso-pagination:widow-orphan;"
Key HOME
EndSelect
Key DEL
Key DOWN ARROW
StartSelect
Find Select "mso-fareast-font-family:"Times New Roman";}"
Key HOME
EndSelect
Key DEL
Key DOWN ARROW
StartSelect
Find Select "aaaaaaa"
Key HOME
EndSelect
Key DEL
Find "bbbbbbbb"
StartSelect
EndSelect
Key Ctrl+LEFT ARROW
StartSelect
Key HOME
Copy
EndSelect
Key UP ARROW
Key UP ARROW
Key UP ARROW
StartSelect
Key DOWN ARROW
Key DOWN ARROW
Key DOWN ARROW
Key DOWN ARROW
Find RegExp "%[ ^t]+"
Replace All SelectText "^c"
EndSelect
Key DOWN ARROW
StartSelect
Find Select "color:purple;"
EndSelect
Key DEL
ClearClipboard
Clipboard 0
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4058
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Find/Replace/Regular Expressions