Loading ...
Sorry, an error occurred while loading the content.

deleting duplicate lines

Expand Messages
  • m_frascinella
    Hi, I searched the archive and couldn t find anything I can directly use. I have a clip that extracts lines you specify (tag names) from a Framemaker MIF file,
    Message 1 of 9 , Nov 3, 2011
    • 0 Attachment
      Hi,

      I searched the archive and couldn't find anything I can directly use.

      I have a clip that extracts lines you specify (tag names) from a Framemaker MIF file, writes them to a file, and sorts them. The result is sometimes hundreds of duplicate tag names.

      NoteTab does not seem to have a menu command or clip command to remove duplicate lines, so I would like to know if someone could explain how to do that.

      Here is my clip as it now stands:

      ^!Continue This clip copies all lines contain the text string you specify, and puts them into a new file.
      ^!Set %Searchstring%=^?{Enter search string:}
      ^!SetListDelimiter ^P
      ^!Set %Lines%=^$GetDocMatchAll(^.*^%Searchstring%.*$)$

      ; open a new document and insert the found lines
      ^!Toolbar New Document
      ^!InsertText ^%Lines%

      ; remove all leading spaces before sorting
      ^!Replace "^[\s\t]+" >> "" AIRSW

      ; sort the lines in ascending order (a-z)
      ^!Menu modify/lines/sort/ascending
      ^!Select 0

      ; remove duplicate lines


      Yours,

      Michael F.
      ==========
    • Jean-François Colas
      Hello, Would the checkbox Sort reoves duplicates , in the View / Options menu, tab Tools, fit? However I can t help for using this setting in clip if you
      Message 2 of 9 , Nov 3, 2011
      • 0 Attachment
        Hello,

        Would the checkbox "Sort reoves duplicates", in the View / Options menu,
        tab Tools, fit?

        However I can't help for using this setting in clip if you don't want NT
        to behave that way all the time.

        Regards,
        J.-F.

        03/11/2011 17:35, m_frascinella a écrit :
        > Hi,
        >
        > I searched the archive and couldn't find anything I can directly use.
        >
        > I have a clip that extracts lines you specify (tag names) from a Framemaker MIF file, writes them to a file, and sorts them. The result is sometimes hundreds of duplicate tag names.
        >
        > NoteTab does not seem to have a menu command or clip command to remove duplicate lines, so I would like to know if someone could explain how to do that.
        >
        > Here is my clip as it now stands:
        >
        > ^!Continue This clip copies all lines contain the text string you specify, and puts them into a new file.
        > ^!Set %Searchstring%=^?{Enter search string:}
        > ^!SetListDelimiter ^P
        > ^!Set %Lines%=^$GetDocMatchAll(^.*^%Searchstring%.*$)$
        >
        > ; open a new document and insert the found lines
        > ^!Toolbar New Document
        > ^!InsertText ^%Lines%
        >
        > ; remove all leading spaces before sorting
        > ^!Replace "^[\s\t]+">> "" AIRSW
        >
        > ; sort the lines in ascending order (a-z)
        > ^!Menu modify/lines/sort/ascending
        > ^!Select 0
        >
        > ; remove duplicate lines
        >
        >
        > Yours,
        >
        > Michael F.
        > ==========
        >
        >
        >
        > ------------------------------------
        >
        > Fookes Software: http://www.fookes.com/
        > NoteTab website: http://www.notetab.com/
        > NoteTab Discussion Lists: http://www.notetab.com/groups.php
        >
        > ***
        > Yahoo! Groups Links
        >
        >
        >
      • diodeom
        ... ^!Replace ^(.+) R K( 1( R| Z))+ WARS
        Message 3 of 9 , Nov 3, 2011
        • 0 Attachment
          --- In ntb-clips@yahoogroups.com, "m_frascinella" <mfrascinella@...> wrote:
          >
          > ; remove duplicate lines
          >

          ^!Replace "^(.+)\R\K(\1(\R|\Z))+" >> "" WARS
        • Don
          Well that depends, sort can be set to remove duplicate lines. Of course they are then also sorted. See view options to set it.
          Message 4 of 9 , Nov 3, 2011
          • 0 Attachment
            Well that depends, sort can be set to remove duplicate lines. Of course
            they are then also sorted.

            See view > options to set it.

            On 11/3/2011 12:35 PM, m_frascinella wrote:
            > Hi,
            >
            > I searched the archive and couldn't find anything I can directly use.
            >
            > I have a clip that extracts lines you specify (tag names) from a Framemaker MIF file, writes them to a file, and sorts them. The result is sometimes hundreds of duplicate tag names.
            >
            > NoteTab does not seem to have a menu command or clip command to remove duplicate lines, so I would like to know if someone could explain how to do that.
            >
            > Here is my clip as it now stands:
            >
            > ^!Continue This clip copies all lines contain the text string you specify, and puts them into a new file.
            > ^!Set %Searchstring%=^?{Enter search string:}
            > ^!SetListDelimiter ^P
            > ^!Set %Lines%=^$GetDocMatchAll(^.*^%Searchstring%.*$)$
            >
            > ; open a new document and insert the found lines
            > ^!Toolbar New Document
            > ^!InsertText ^%Lines%
            >
            > ; remove all leading spaces before sorting
            > ^!Replace "^[\s\t]+" >> "" AIRSW
            >
            > ; sort the lines in ascending order (a-z)
            > ^!Menu modify/lines/sort/ascending
            > ^!Select 0
            >
            > ; remove duplicate lines
            >
            >
            > Yours,
            >
            > Michael F.
            > ==========
            >
            >
            >
            > ------------------------------------
            >
            > Fookes Software: http://www.fookes.com/
            > NoteTab website: http://www.notetab.com/
            > NoteTab Discussion Lists: http://www.notetab.com/groups.php
            >
            > ***
            > Yahoo! Groups Links
            >
            >
            >
            >
          • Axel Berger
            ... ^$StrSort( Str ;CaseSensitive;Ascending;RemoveDuplicates)$ (added in v4.52) Returns the specified text Str sorted according to the defined criteria.
            Message 5 of 9 , Nov 3, 2011
            • 0 Attachment
              Jean-François Colas wrote:
              > However I can't help for using this setting in clip if you don't want NT
              > to behave that way all the time.

              ^$StrSort("Str";CaseSensitive;Ascending;RemoveDuplicates)$
              (added in v4.52)

              Returns the specified text "Str" sorted according to the defined
              criteria. NoteTab 5 supports two new values for the CaseSensitive
              parameter: ANSI to enforce a case sensitive dictionary-type sorting
              order and False_ANSI to ignore character case during sorting. The ANSI
              option produces a sorting order that matches the result from the
              Modify/Lines/Sort menu command. Note, however, that sorting is much
              slower with the ANSI option.

              For example, the following instruction will sort the lines contained in
              the Clipboard, in ascending order, ignoring character case, and removing
              duplicates:

              Axel

              --
              Dipl.-Ing. F. Axel Berger Tel: +49/ 2174/ 7439 07
              Johann-Häck-Str. 14 Fax: +49/ 2174/ 7439 68
              D-51519 Odenthal-Heide eMail: Axel-Berger@...
              Deutschland (Germany) http://berger-odenthal.de
            • m_frascinella
              Axel, Jean-Francois s tip about View - Options - Tools - Sort Removes Duplicates definitely worked as a manual way to sort and remove duplicate lines. I
              Message 6 of 9 , Nov 3, 2011
              • 0 Attachment
                Axel,

                Jean-Francois's tip about View -> Options -> Tools ->Sort Removes Duplicates definitely worked as a manual way to sort and remove duplicate lines.

                I tried the StrSort statement but could not get it to work.

                First of all, the StrSort statement did not turn blue (valid) as with other Notetab statements.

                Second, I was not sure how to grab all the lines I extracted. I tried this thinking that my %Lines% variable was still active.
                ^$StrSort("^%Lines%";False;true;true)$

                That did not work.

                Then I tried:
                ^!Select all
                ^$StrSort("^$GetClipboard$";False;true;true)$

                But this resulted in nothing in the new file but the StrSort statement.

                What is wrong? The StrSort statement does not seem to be working for me.

                Yours,

                Michael F


                --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
                >
                > Jean-François Colas wrote:
                > > However I can't help for using this setting in clip if you don't want NT
                > > to behave that way all the time.
                >
                > ^$StrSort("Str";CaseSensitive;Ascending;RemoveDuplicates)$
                > (added in v4.52)
              • Don
                ^!Select all ^$StrSort( ^$GetSelection$ ;False;true;true)$
                Message 7 of 9 , Nov 3, 2011
                • 0 Attachment
                  ^!Select all
                  ^$StrSort("^$GetSelection$";False;true;true)$

                  On 11/3/2011 4:13 PM, m_frascinella wrote:
                  > ^!Select all
                  > ^$StrSort("^$GetClipboard$";False;true;true)$
                • m_frascinella
                  Don, Thanks for the correction. The clip now works perfectly. I am still puzzled as to why the ^$StrSort statement does not turn blue as with other NoteTab
                  Message 8 of 9 , Nov 4, 2011
                  • 0 Attachment
                    Don,

                    Thanks for the correction. The clip now works perfectly.

                    I am still puzzled as to why the ^$StrSort statement does not turn blue as with other NoteTab statements.

                    Is there something different about statements that begin with ^$ compared with ^! statements?

                    Yours,

                    Michael F
                    =========


                    --- In ntb-clips@yahoogroups.com, Don <don@...> wrote:
                    >
                    > ^!Select all
                    > ^$StrSort("^$GetSelection$";False;true;true)$
                    >
                    > On 11/3/2011 4:13 PM, m_frascinella wrote:
                    > > ^!Select all
                    > > ^$StrSort("^$GetClipboard$";False;true;true)$
                    >
                  • Axel Berger
                    ... Yes, ^$ is a function not a command. What Don gave works, but the canonical correct use would have been either ^!Set %variable%=^$function$ or ^!InsertText
                    Message 9 of 9 , Nov 4, 2011
                    • 0 Attachment
                      m_frascinella wrote:
                      > Is there something different about statements that begin
                      > with ^$ compared with ^! statements?

                      Yes, ^$ is a function not a command. What Don gave works, but the
                      canonical correct use would have been either
                      ^!Set %variable%=^$function$
                      or
                      ^!InsertText ^$function$

                      You can omit the ^!InsertText, but you ought not to.

                      Axel
                    Your message has been successfully submitted and would be delivered to recipients shortly.