removing of junk character

Dear ALL,
How to remove junk charecter ^M from unix file i am using sun solaris unix.
I already tried few commands

:%s/^M//g
:%s/r//g
 

but it didnt helped me.

Any help appriciated.

Thanks

Ripudaman

try dos2unix command

 
dos2unix filename filename

how to do that i have to transfer the file to local system??
then again to unix??

---------- Post updated at 03:02 AM ---------- Previous update was at 02:54 AM ----------

u there pls tell me is there any way to remove that word there is only one option manually or what??

As you mentioned, "i am using sun solaris"

you can use dos2unix command

Try like..

tr -d '\r' <test.txt 

Please try:-

sed 's/'"$(printf '\015')"'$//g' input_file > output_file