replace using tagged expressions

replace using tagged expressions

2
NewbieNewbie
2

    Oct 03, 2006#1

    I got a textfile like this

    "
    set [$APPL_CODE] = SLP
    set [$MYSQL_SERVER] = ecarl0.bc
    set [$MYSQL_PORT] = 304
    set [$DB_DISK_QUOTA] = 00Mb

    in [$MYSQL_server]
    logon with ssh e.g. from ecar0o.bc with ssh mysql@[$MYSQL_SERVER]
    (password is the same as for oracle-user)
    verify that the new filesystems are owned by mysql:mysql :
    /users/application/mydb[$MYSQL_PORT]
    "
    off course with a lot more codes and text.
    I want to replace every occurence of text between [] with the value assigned to it in the "set " line.

    I created a macro like this

    "
    InsertMode
    ColumnModeOff
    HexOff
    UnixReOff
    Find RegExp "set ^(^[^$MYSQL_SERVER^]^) = ^(*^) ^p"
    Find RegExp "^1"
    Replace All "^2"
    Find RegExp "set ^(^[^$MYSQL_PORT^]^) = ^(*^) ^p"
    Find RegExp "^1"
    Replace All "^2"
    Find RegExp "set ^(^[^$WEB_SERVER^]^) = ^(*^) ^p"
    Find RegExp "^1"
    Replace All "^2"
    "

    but apparantly the second find where he looks for tagged expression 1 fails (although it exists)
    Can someone help me out ?

    6,675585
    Grand MasterGrand Master
    6,675585

      Oct 03, 2006#2

      Read the help of UltraEdit more carefully. The codes ^1^2^3 ... cannot be used in a search string, only in a replace string. What I think you want to do (always good to have an example before and after macro execution) could be done with following macro:

      InsertMode
      ColumnModeOff
      HexOff
      Find "set [$MYSQL_SERVER] = "
      StartSelect
      Key END
      EndSelect
      Find "[$MYSQL_SERVER]"
      Replace All "^s"
      Find "set [$MYSQL_PORT] = "
      StartSelect
      Key END
      EndSelect
      Find "[$MYSQL_PORT]"
      Replace All "^s"
      Find "set [$WEB_SERVER] = "
      StartSelect
      Key END
      EndSelect
      Find "set [$WEB_SERVER] = "
      Replace All "^s"
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Oct 05, 2006#3

        Thanks Mofi
        This does the trick (with some minor modifications)