Find Selected text not ok

Find Selected text not ok

5
NewbieNewbie
5

    Apr 15, 2005#1

    says, i have those line below and i want to keep the first line only, but want to delete those 0504 in the rest of file


    8759 6981 0504 <- always at first line for searching and wanted.
    8112 6981 0504 <- 0504 to be deleted
    7771 6451 0504 <- 0504 to be deleted
    6661 6166 0504 <- 0504 to be deleted

    i want the result as below:
    8112 6981
    7771 6451
    6661 6166


    here my macro that failed, it doesnt keep the line 8759 6981 0504 , instead it delete whole 0504 in the file.

    copy // 0504
    Find RegExp "^c"
    Replace All ""

    is it possible to use selected line and then replace it?

    206
    MasterMaster
    206

      Apr 15, 2005#2

      Try this:

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOn
      Key HOME
      "@~@"
      Find RegExp "^([0-9].*)0504$"
      Replace All "\1"
      Top
      Find "@~@"
      Replace ""
      Software For Metalworking
      http://closetolerancesoftware.com

      5
      NewbieNewbie
      5

        Apr 16, 2005#3

        Foremost, thanks. The result from 1) to (2)

        (1)
        8759 6981 0504
        8112 6981 0504
        7771 6451 0504
        6661 6166 0504

        (2)
        8759 6981
        8112 6981 0504
        7771 6451 0504
        6661 6166 0504

        but i would like the answer below

        8759 6981 0504
        8112 6981
        7771 6451
        6661 6166

        206
        MasterMaster
        206

          Apr 16, 2005#4

          When I put the cursor anywhere in the first line containing a string of digits,(8759 6981 0504 in this case), then run the macro, it works properly for me.

          This slight modification will find the first line ending in 0504 for you before making the changes.

          Otherwise, I guess I'm not sure what you're after.


          InsertMode
          ColumnModeOff
          HexOff
          UnixReOn
          Top
          Find RegExp "0504$"
          Key HOME
          "@~@"
          Find RegExp "^([0-9].*)0504$"
          Replace All "\1"
          Top
          Find "@~@"
          Replace ""
          Software For Metalworking
          http://closetolerancesoftware.com

          5
          NewbieNewbie
          5

            Apr 17, 2005#5

            Again, thanx.
            The above solution done well.

            Now, let say i have the line below

            8759 6981 0504 (but if the 0504 is changing to any random number, eg 9777, 6623, 8511. That means the third number is always need to be changed.)

            7673 7136 0775 7393
            4550 0664 6985 1391
            0504 0207 5946


            my solution here not working

            InsertMode
            ColumnModeOff
            HexOff
            UnixReOn
            top
            key end
            key left arrow
            SelectWord
            Top
            Find RegExp "^s[\t]"
            Key HOME
            "@~@"
            Find RegExp "^([0-9].*)^s[\t]"
            Replace All "\1"
            Top
            Find "@~@"
            Replace ""

              Apr 17, 2005#6

              xmen wrote:Again, thanx.
              The above solution done well.

              Now, let say i have the line below

              8759 6981 xxxx // xxxx is any random number and wish to be
              // selected and changed
              7673 7136 0775 7393
              4550 xxxx 6985 1391
              0504 0207 5946

              wanted result is

              8759 6981 xxxx

              7673 7136 0775 7393
              4550 6985 1391
              0504 0207 5946


              my solution here not working

              InsertMode
              ColumnModeOff
              HexOff
              UnixReOn
              top
              key end
              key left arrow
              SelectWord
              Top
              Find RegExp "^s[\t]"
              Key HOME
              "@~@"
              Find RegExp "^([0-9].*)^s[\t]"
              Replace All "\1"
              Top
              Find "@~@"
              Replace ""

                Apr 19, 2005#7

                since ^s not working, alternative solution is to use ^c, here the code

                GotoLine 1
                Loop 10
                Key RIGHT ARROW
                EndLoop
                SelectWord
                Copy
                Top
                Find "^c" // find the first line random number
                Key END
                Find "^c" // find the 2nd then replace, Similiar to "Find & replace" button
                Replace ""