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

trying to remove some spaces at the end of a line

Expand Messages
  • Don Passenger
    I have just started a clip. A little rough so far, but it isn t behaving the way I want already.... I want to be able to take a .txt file with multiple lines,
    Message 1 of 2 , Sep 4, 2000
      I have just started a clip. A little rough so far, but it isn't behaving
      the way I want already....

      I want to be able to take a .txt file with multiple lines, remove the spaces
      from the right end of each line.
      Take 4 lines of "input" and make it pipe delimited and carraige return then
      do over.

      I am using "x" instead of spaces at the end of the line because I can see
      them working. On the first loop, it removes the x at the end, and on the
      next it doesn't, even though I can see it selected...

      Here is my text file for testing:
      this is line 1x
      this is line 2x
      this is line 3
      this is line 4x
      this is line a
      this is line bx
      this is line c
      this is line d

      Here is my clip:
      ;this is a clip to take x lines of secondary file
      ;and render them in a pipe delimited file
      ;by Don Passenger dpasseng@...
      :START
      ^!Jump DOC_START
      ^!Set %Counter%=4
      :REPEATFIND
      ^!Jump LINE_END
      ^!Select -1
      ^!INFO "***^$GetSelection$***"
      ^!If ^$GetSelection$ = "x" SPACE ELSE NOSPACE
      ^!INFO "got to after if"
      :SPACE
      ^!INFO "got to space"
      ^!Replace "x" >> "" H
      ^!If %Counter% = "0" END ELSE REPEATAGAIN
      :REPEATAGAIN
      ^!Dec %Counter%
      ^!MoveCursor 1
      ^!Goto REPEATFIND
      ^!Goto END
      :NOSPACE
      ^!INFO "no space"
      :END

      Here is the output I want when I am done:

      this is line 1|this is line 2|this is line 3|this is line 4
      this is line a|this is line b|this is line cthis is line d

      I haven't gotten to the pipe part yet obviously as I cannot remove the "x"
      ... and in the real file, I have spaces instead of "x" I am trying to
      remove.

      ---
      Don Passenger
      Personal Page: http://www.iserv.net/~dpasseng
      Court Page: http://www.iserv.net/~dpasseng/grdc
    • Jody
      Hi Don, ... Use the T option: ^!Replace x HT I don t understand your Clip totally because you abort out of it if no space (x) is found leaving the
      Message 2 of 2 , Sep 4, 2000
        Hi Don,

        >I am using "x" instead of spaces at the end of the line because I
        >can see them working. On the first loop, it removes the x at the
        >end, and on the next it doesn't, even though I can see it
        >selected...
        >
        >^!INFO "got to space"
        >^!Replace "x" >> "" H

        Use the "T" option:

        ^!Replace "x" >> "" HT

        I don't understand your Clip totally because you abort out of it if
        no space (x) is found leaving the rest of the lines undone. See if
        you can use part or all of the following. It assumes you want to do
        the whole document and that there is a final return after the last
        line of text.

        H=Maybe?
        ^!Jump 1
        ^!Set %n%=1

        :Start
        ^!Select Eol
        ^$StrTrim("^$GetSelection$")$
        ^!Replace "^p" >> "|" S
        ^!IfError End
        ^!Inc %n%
        ^!If ^%n% = 4 Skip
        ^!Goto Start

        ^!Set %n%=1
        ^!Select Eol
        ^$StrTrim("^$GetSelection$")$
        ^!Jump +1
        ^!Goto Start

        Happy Clip'n!
        Jody

        http://www.sureword.com/notetab

        Subscribe, UnSubscribe, Options
        mailto:Ntb-Clips-Subscribe@...
        mailto:Ntb-Clips-UnSubscribe@...
        http://www.egroups.com/group/ntb-clips
      Your message has been successfully submitted and would be delivered to recipients shortly.