sed command in c shell

Hi,

To insert a single quote at the end of every line in a file , I do this:

sed "s:$:':" temp.txt

Works like a charm in k shell, but errors out in c shell.

Any inputs what could be wrong here?

Thanx

try this..

sed -e "s/^\(.*\)$/\1\'/g" yourfile > newfile

Cheers!
Vishnu.

This also works on k shell but not on c shell.
I get a variable syntax error.

Try:
sed 's:$:'\'\:

Works great, perderabo.

Could you pl explain this elegant one liner to me?

It is the same as yours with different quoting. With csh, a $ inside quote quotes won't fly. So I put it inside single quotes. The single quote cannot be inside a single quotes so I used a backslash on it. That left one character to be quoted, I used a backslash there as well.