Coming Soon: GET:IT Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET Coming Soon: GET:IT Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET

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

Home Forums Scripting General Scripting VB Script – Text File Edit: Find unique multi line entry and edit

Viewing 1 post (of 1 total)
  • Author
    Posts

  • CaTBuS
    Member
    #167246

    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 = [color=red]1521[/color])))
    (CONNECT_DATA = (SID = [color=red]cp03[/color]))
    )

    To:

    Code:
    Server.world =
    (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (COMMUNITY = tcp.world) (PROTOCOL = TCP) (Host = server.company.com) (Port = [color=green]1524[/color])))
    (CONNECT_DATA = (SID = [color=green]cp12[/color])
    )

    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.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Live Webinar: Active Directory Security: What Needs Immediate Priority!Live on Tuesday, October 12th at 1 PM ET

Attacks on Active Directory are at an all-time high. Companies that are not taking heed are being punished, both monetarily and with loss of production.

In this webinar, you will learn:

  • How to prioritize vulnerability management
  • What attackers are leveraging to breach organizations
  • Where Active Directory security needs immediate attention
  • Overall strategy to secure your environment and keep it secured

Sponsored by: