Tapatalk

Keep lines that end with a /

Keep lines that end with a /

161
Basic UserBasic User
161

    Jun 22, 2006#1

    I have a huge list of lines and need to keep only the lines that have a trailing forwardslash /

    Also, what would be the code to remove all lines that contain a trailing forward slash?

    Example:

    abc/abc/abc/ ***has trailing forwardslash
    abc/abc/abc/filename.txt ***does not have trailing forwardslash

    6,685587
    Grand MasterGrand Master
    6,685587

      Jun 22, 2006#2

      See Delete all lines not starting with a special phrase how to do it manually or use the first macro from this forum thread and replace the line

      Find MatchCase RegExp "%Starting phrase*^p"
      by
      Find RegExp "%*/^p"


      Or use the macro at How to delete all lines not containing specific word or string or expression? with UnixReOff and replace the line

      Find "[images]"
      by
      Find RegExp "/$"
      Best regards from an UC/UE/UES for Windows user from Austria

      161
      Basic UserBasic User
      161

        Jun 22, 2006#3

        That works for a starting phrase, but I need something that will look at the last character and then if it is != to a forwardslash, then delete the line.

        For the example file:
        abc/abc/abc/
        abc/abc/abc/filename.txt

        The code you posted does not flag either line as one that contains a forwardslash. I tried placing a "/" inside the find, but that didn't work.

          Jun 23, 2006#4

          Hmmm.. I just tried again to search for %*/^p and it picked up every line. Not sure why this didn't work before.

          I basically did a find that line, and replace it with some odd text combination, and then did a find the off text combo, and replace it with blank to delete it. Looks like it worked :)