Open Source Development

Power Open Source Development

Explore the open source tools and capabilities for building and deploying modern applications on IBM Power platforms including AIX, IBM i, and Linux.


#Power


#Power


#Servers
#Opensource
 View Only
Expand all | Collapse all

Replace two strings at a time in a text file.

  • 1.  Replace two strings at a time in a text file.

    Posted 03/09/20 01:26 PM

    Originally posted by: pharryr


    I have a requirement to replace two strings at a time in a text file from within a BASH script.

     

    SomeCommand ${FindString} ${ReplaceWithString}

     

    Where…

    "SomeCommand" is usable in a BASH 5 script on AIX 7.2

    ${FindString} is an OS environment variable

    ${ReplaceWithString} is an OS environment variable

    The original file is updated, not just the command's buffer.


    #AIXOpenSource
    #AIX-Open-Source-Software


  • 2.  Re: Replace two strings at a time in a text file.

    Posted 03/17/20 06:38 AM

    Originally posted by: nagger


    Hi,

    This is a very basic shell script request.

    Use the mv command and sed.

     

    You should get some training, watch YouTube videos, get a friend that knows AIX or Linux or ask the question on Google.

    Good luck, Nigel

     


    #AIXOpenSource
    #AIX-Open-Source-Software