Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Deleting extra blank lines in -cleanlog-


From   Rajesh Tharyan <[email protected]>
To   [email protected]
Subject   RE: st: Deleting extra blank lines in -cleanlog-
Date   Tue, 19 Feb 2008 00:27:51 -0000

Hi,

Following is the word macro I use. Sometimes I run programs in sas and I
need to do something similar to what you are looking for, to the output list
(text) files. I have assigned this macro to a button and put it on the menu
bar.


Sub macro2()

    Selection.WholeStory
    Selection.Font.Size = 6
    
     Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "^p^p^p"
        .Replacement.Text = "^p"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "^m"
        .Replacement.Text = "^p"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

End Sub

Hope this helps
rajesh

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Sergiy Radyakin
Sent: 18 February 2008 23:18
To: [email protected]
Subject: Re: st: Deleting extra blank lines in -cleanlog-

Yes, you iteratively replace all ^p^p^p with ^p^p in Word (if it is a
one-time work).
If you need this routinely -- loop through the lines of your log file,
and skip all the empty lines.
If you want to have one line empty, set a flag each time you have it.
Reset the flag after a non-empty line is output.

This is very rough. You might want to be more formal and define a
concept of whitespace, where you decide how to treat spaces, tabs,
CR/LF and other similar stuff. But that's probably not what you are
looking for,

Sergiy




On Feb 18, 2008 4:53 PM, Allan Joseph Medwick <[email protected]> wrote:
> Hi, All,
>
> Is there a quick way to delete all of the multiple empty lines created
> by -cleanlog-?  I'd like to compress my file, but keep one line
> between any text that is left for readability.
>
> Thanks,
> Allan
>
> --
> Allan Joseph Medwick, MGA
> Doctoral Student, Higher Education Management
> University of Pennsylvania Graduate School of Education
> Telephone: 267.872.0336
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index