how to use "sed" to replace old directory to new directory in a file
- From: "sk" <sangeetha.kolandasamy@xxxxxxxxx>
- Date: 29 Jun 2006 04:01:14 -0700
All
please guid me....
i want to know how to replace the old directory to new directory in a
file..
example: let us consider the below line
open (LOG,">>/user/xxxx/yyyy/zzzz/aaaa/bbbb/.cccc") || die;
to
open (LOG,">>/wwww/qqqqq/pppp/rrrrr/ssss/tttt/.lllll") || die;
like this i want to replace many lines in which each line has different
directories to new different directory
i tried with
oldpath=/user/xxxx/yyyy/zzzz/aaaa/bbbb/.cccc
newpath=/wwww/qqqqq/pppp/rrrrr/ssss/tttt/.lllll
cat -n filename | grep 61 | sed "s/$oldpath/$newpath/" filename
am getting error
(where 61 is the line no. where i have to do changes...)
help me pls...
waiting for reply
thanx n advance
sk
.
- Follow-Ups:
- Prev by Date: Re: how to grep show filename??
- Next by Date: Re: how to grep show filename??
- Previous by thread: how to grep show filename??
- Next by thread: Re: how to use "sed" to replace old directory to new directory in a file
- Index(es):