Find the answer to your Linux question:
Results 1 to 2 of 2
Hi I have the following variables: R_PATH_SYSTEM=/users/a R_PATH_TEST=/users/b R_PATH=${R_PATH_SYSTEM} Now I have to switch between R_PATH_SYSTEM and R_PATH_TEST. Meaning I want to replace R_PATH=${R_PATH_SYSTEM} with R_PATH=${R_PATH_TEST} I've tried this one: ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2010
    Posts
    1

    bash replace sed


    Hi

    I have the following variables:
    R_PATH_SYSTEM=/users/a
    R_PATH_TEST=/users/b

    R_PATH=${R_PATH_SYSTEM}

    Now I have to switch between R_PATH_SYSTEM and R_PATH_TEST. Meaning I want to replace R_PATH=${R_PATH_SYSTEM} with R_PATH=${R_PATH_TEST}

    I've tried this one:
    sed -e "s/R_PATH=${R_PATH_SYSTEM}/R_PATH_${R_PATH_TEST}/g" $i > aaaa

    and this one:
    #sed -e s/R_PATH=\"${R_PATH_SYSTEM}"/R_PATH=\"${R_PATH_TEST}"/g $k > yyyy

    (and many more )

    appreciate your support!

  2. #2
    Just Joined! barriehie's Avatar
    Join Date
    Apr 2008
    Location
    The Desert!
    Posts
    85
    Quote Originally Posted by lllll View Post
    Hi

    I have the following variables:
    R_PATH_SYSTEM=/users/a
    R_PATH_TEST=/users/b

    R_PATH=${R_PATH_SYSTEM}

    Now I have to switch between R_PATH_SYSTEM and R_PATH_TEST. Meaning I want to replace R_PATH=${R_PATH_SYSTEM} with R_PATH=${R_PATH_TEST}

    I've tried this one:
    sed -e "s/R_PATH=${R_PATH_SYSTEM}/R_PATH_${R_PATH_TEST}/g" $i > aaaa

    and this one:
    #sed -e s/R_PATH=\"${R_PATH_SYSTEM}"/R_PATH=\"${R_PATH_TEST}"/g $k > yyyy

    (and many more )

    appreciate your support!
    Please post the aaaa and yyyy files!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •