Input file - tmp
<begin>
./00003/
./00004/
<end>
I would like to replace "." with the value of pwd
so that the output will look like
/dev/project/00003/
t=`pwd`
sed -e "s/\./$t/g" tmp > tmp1;
The above piece of code is not working. Appreciate your help.
zaxxon
2
t=`pwd`
sed -e 's/\./'${t}'/g' tmp > tmp1;
It is still throwing the error.
sed: 0602-404 Function s/\.//dev/project/g cannot be parsed.
use this
set file name as command line arg
cat $1 | while read line
do
grep "./" $1
if [ $? -eq 0 ]
then
rep=${line/.\//$PWD/}
echo $rep >>tmp1
else
echo $line >>tmp1
fi
done
exit 0
I corrected it on my own with the below code...
t=`pwd`
sed -e "s|\.|$t|g" tmp1 > tmp;
it worked...
Folks, thanks for your responses...