Unix Programming - Re: how to use "sed" to replace old directory to new directory in a file

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > June 2006 > Re: how to use "sed" to replace old directory to new directory in a file





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: how to use "sed" to replace old directory to new directory in a file
sk

2006-06-30, 7:25 am

thanx .... i got the answer by trying as u said

if i use : instaed of # .... i can get the correct answer


Jim Cochrane wrote:
> On 2006-06-30, sk <sangeetha.kolandasamy@gmail.com> wrote:
>
> Looks like you missed something. (In case you don't know, many programs
> that take regexes [sed, ed, ex, etc.] allow use of delimiters other than
> '/' - so the suggestion is to use '#' instead of '/'.)
>
> I had to try it out to make sure this works (since you seem to be implying
> that it doesn't) in the context you're discussing - works fine for me with
> this test script on FC 4:
>
> oldpath=/user/xxxx/yyyy/zzzz/aaaa/bbbb/.cccc
> newpath=/wwww/qqqqq/pppp/rrrrr/ssss/tttt/.lllll
>
> echo $oldpath|sed "s#$oldpath#$newpath#"
> exit 0
>
>
> You're doing it the hard way.
>
>
>
> --


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com