Gaura's Oracle Retail Support Forum

CTRL-M (^M) characters in the script file
16-05-2024 prafulla salianAfter i updated the .ksh / .sh file in the windows and ftped it, I m getting the Ctrl-M(^M) characters in the file when i m opening the file in the unix box.
16-05-2024 syamIt happens when file has been transferred between windows systems to unix/linux. New line character is different in both of these systemms. For example, Windows-based text editors will have a special carriage return character (CR+LF) at the end of lines to denote a line return or newline, which will be displayed incorrectly in Unix (^M). This can be difficult to spot, as some applications or programs may handle the foreign newline characters properly while others do not. This typically occurs when a file is transferred from MS-DOS (or MS-Windows) without ASCII or text mode. Solution : Notepad ++ or other text editor has ability to select the file type. select Unix for the same, in notepad++, its there in the status bar righthand side. use unix utility 1. dos2unix filename 2. sed -e "s/\r//g" file > newfile 3. Using a terminal editor vi or vim: Inside vi [in ESC mode] type: :%s/^M//g Note: To enter ^M, type CTRL-V + M. That is, hold down the CTRL key then press V and M in succession.




You must be signed in to post a reply. Sign in