On Tue, Dec 11, 2007 at 10:21:22PM +0200, Halid Faith wrote:
> Ok
> But I have another problem,
> I couldn't use any command  interior of sed command. That's to say I have a
> script;
> 
> yy="file5"
>  for i in `cat file1`;
>  do
>  sed -e 's/old1/new1\ \'$i'/g' -e 's/old2/'cut -d, -f 1 ${yy}'/g'   file2 >
> file3
>  done
> 
> When I run the script,  I get an error, due to using cut command
> 


yy=file5
for i in `cat file1` ; do 
    sed -e "s/old1/new1 $i/g" -e "s/old2/`cut -d, -f 1 ${yy}`/g" file2 > file3
done


I changed the single-quotes to double-quotes so that they can have
their variables interpreted.  The problem with this loop is that, at
each iteration, file3 will be overwritten.

-- 
John D. "Trix" Farrar               __\\|//__               Basement.NET
[EMAIL PROTECTED]                   (` o-o ')   http://www.basement.net/
-----------------------------------ooO-(_)-Ooo--------------------------

Attachment: pgpFHWwWMbsPX.pgp
Description: PGP signature

Reply via email to