0

I run the command unix2dos <file_path> and to make sure I opened the file but it doesn't show me ^M. can anyone tell me the reason?

I want to run some command to copy some text to another file with the windows line ending. But the destination where I want to copy it doesn't have to install the dos2unix package. So I want it to convert the file to DOS at source location then copy it but when I run unix2dos it doesn't show me ^M when opened in vi. so could anyone please tell me how can I make sure that the source is getting copied at destination with windows line endings?

MUKHTAR INAMDAR
  • 85
  • 4
  • 17
  • StackOverflow is dedicated to helping solve programming code problems. Your Q seems more appropriate for [su] , but read their help section regarding on-topic questions . AND please read [Help On-topic](https://stackoverflow.com/Help/On-topic) and [Help How-to-ask](https://stackoverflow.com/Help/How-to-ask) before posting more Qs here. Good luck. – shellter Feb 04 '20 at 17:16
  • If it's converted right, I don't think vi would necessarily show you control m's. I can tell you how to convert in powershell https://stackoverflow.com/questions/724083/unix-newlines-to-windows-newlines-on-windows/52593215#52593215 – js2010 Feb 05 '20 at 04:19
  • Hi @shellter I need the script or shell command so it will send the file to destination like using scp but before that need to convert it to DOS however I tried using dos2unix but when I open to confirm but it is not showing ^M at the end of the line however the text which I actually written in windows shows ^m. in vi I can manually add by appending ctrl+V+M but need command to change the while file – MUKHTAR INAMDAR Jun 17 '20 at 06:58
  • 1
    yes, you have reposted your question (Q) as a comment. Please learn to read the comments readers leave for you because what you have posted is not a programming Q. But, just this one time, I may be able to help. Just try using `cat -vet file` to see if you see `^M$` at the end of your converted file. If you don't then something else is wroing with how you are using `unix2dos`. Good luck. – shellter Jun 17 '20 at 14:46
  • Hi @shellter, The question was asked as I think, I need to fire some more commands besides unix2dos so I can see a similar effect i.e. ^M when I open it with vi. Thanks for your answer and suggestion I will post such a question on other portal and not on this programming portal. – MUKHTAR INAMDAR Jun 23 '20 at 07:40

1 Answers1

0

Thanks, @shellter I understand what you want to say. anyway, unix2dos command works well but to confirm I can use cat -vet file.

MUKHTAR INAMDAR
  • 85
  • 4
  • 17