insert text at the begining of each line

insert text at the begining of each line

4
NewbieNewbie
4

    Jun 12, 2006#1

    hello

    can you tell me please, how can I insert some text at the begining and at the end of each line ?

    thanks!

    6,686585
    Grand MasterGrand Master
    6,686585

      Jun 13, 2006#2

      UltraEdit style regular expression:

      Find What: %^(*^)$
      Replace With: text at begin of line^1text at end of line

      Unix/Perl style regular expression:

      Find What: ^(.*)$
      Replace With: text at begin of line\1text at end of line

      Click on the Help button in the Find or Replace dialog and read the help article and the article "Regular Expressions" referenced at this help page.
      Best regards from an UC/UE/UES for Windows user from Austria

      12
      Basic UserBasic User
      12

        Jun 14, 2006#3

        i test this :)

        Code: Select all

        InsertMode
        ColumnModeOff
        HexOff
        UnixReOff
        Top
        Find RegExp "%^(*^)$"
        Replace All "XXX^1XXX"
        replaced all but only last row not :(

        before:

        Code: Select all

        a
        a
        a
        after:

        Code: Select all

        XXXaXXX
        XXXaXXX
        a
        you must use this

        Code: Select all

        a
        a
        a
        
        
        for propher

        Code: Select all

        XXXaXXX
        XXXaXXX
        XXXaXXX
        
        

        6,686585
        Grand MasterGrand Master
        6,686585

          Jun 15, 2006#4

          Correct. The last line of the file must be also terminated with the EOL character(s). Because I often see users which have files where the last line of the file has no line termination, I use following macro code in most of my macros at the beginning to make sure that the last line of the file is also terminated:

          InsertMode
          Bottom
          IfColNum 1
          Else
          "
          "
          EndIf
          Top

          It's very simple. It moves the cursor to the end of the file. If the cursor is now at column 1, fine - nothing must be done because the last line of the file is already terminated. If the cursor at the end of the file is not at column 1, the last line is not terminated and the macro adds now the line termination according to current file format (DOS/UNIX/MAC). Next the cursor is moved back to top of the file before the real macro code starts.
          Best regards from an UC/UE/UES for Windows user from Austria