Find the answer to your Linux question:
Results 1 to 2 of 2
hi All, here is my problem I try to use "sed" command as followig but I got error! path=(`pwd`) . . sed 's/home\/aruna\/WORK\/GUI_test\/testharness/($path)/g' run.tcl >> run1.tcl I cann't figure out ...
  1. #1
    Just Joined!
    Join Date
    Mar 2008
    Posts
    10

    Problem in using sed commnad in bash program.

    hi All,

    here is my problem
    I try to use "sed" command as followig but I got error!

    path=(`pwd`)
    .
    .
    sed 's/home\/aruna\/WORK\/GUI_test\/testharness/($path)/g' run.tcl >> run1.tcl


    I cann't figure out what is the problem with this. When I print path on screen it was having a correct value.

    I think the problem is that path is having "/" characters inside it.

    can you please give me a solution for this?

    Thanks,
    Aruna.

  2. #2
    Linux User
    Join Date
    Jun 2007
    Posts
    318
    That's right, the slash is causing you problems since you're using it as the delimiter in the substitute command in sed. Use something that probably won't appear in the pathname like %

    Code:
    sed "s%home\/aruna\/WORK\/GUI_test\/testharness%$path%g" run.tcl >> run1.tcl
    Also, use double quotes instead of single quotes. Single quotes prevent variable expansion. Also, the ()'s aren't needed.

Posting Permissions

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