Announcement

Collapse
No announcement yet.

VB Script - Text File Edit: Find unique multi line entry and edit

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • VB Script - Text File Edit: Find unique multi line entry and edit

    I work with a standard TNSNAMES.ORA file which can and does get customized by end users as necessary. When global updates are necessary, these customization's make things complicated as overwriting globally isn't possible (I'd loose everybody's customization's). I've been successfully using a "Find & Replace" vb script to edit this file and have had no issues. For instance, I've needed to change all instances of "(SID = CP03)" to "(SID = CP12)." The change I need to make now, however; is a bit more complicated.

    I need to change the following entry from:
    Code:
    Server.world =
      (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (COMMUNITY = tcp.world) (PROTOCOL = TCP) (Host = server.company.com) (Port = 1521)))
                     (CONNECT_DATA = (SID = cp03))
      )
    To:
    Code:
    Server.world =
      (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (COMMUNITY = tcp.world) (PROTOCOL = TCP) (Host = server.company.com) (Port = 1524)))
                     (CONNECT_DATA = (SID = cp12)
      )
    I do not need to change every instance of Port 1521 to 1425 nor do I need to change every instance of SID CP03 to CP12. The Server.world entry is a unique variable but will be on a different line number for a lot of users. Anyway, I've a few ideas on how to accomplish this but haven't come up with anything pretty yet. I don't want to muddy the waters with my ideas so I'll just open this thread clean.

    What would be the cleanest, most efficient way to do this? Looking forward to your suggestions.
    Last edited by CaTBuS; 12th October 2017, 15:08.
Working...
X