Find the answer to your Linux question:
Results 1 to 2 of 2
Hi All, I have problem with FTP. When i am transferring a shell script from Windows to Solaris i am getting some extra characters in the Script. #^M # Program: ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2008
    Posts
    7

    Ftp Problem


    Hi All,

    I have problem with FTP.

    When i am transferring a shell script from Windows to Solaris i am getting some extra characters in the Script.

    #^M
    # Program: csv_to_sas_ds.ksh^M
    # Author: Rajani ^M
    #^M

    Can some one help me regarding the same.

    Regards,
    Rajani.

  2. #2
    Linux Newbie x1a4's Avatar
    Join Date
    Dec 2006
    Posts
    123
    Hi,

    ^M is a line feed character. UNIX/Linux systems use only the carriage return (CR; ASCII 15) character at the end of a line, Mac's use line feed (LF; ASCII 32), and windows uses carriage return and line feed (CRLF)

    Inside vim do this:
    Code:
    :%s/^M$//g
    In the above, ^M is an excape sequence and must be created using Ctrl+V then Ctrl+M. If you type carot-M it will not work.

    Or on the command line using tr:
    Code:
    tr -d '\15\32' < winfile.txt > unixfile
    Or using awk:
    Code:
    awk '{ print $0 "\r"}' unixfile > winfile.txt
    Or using sed
    Code:
    sed 's/\r$//' winfile > unixfile
    Or using perl
    Code:
    perl -p -e 's/\r$//' < winfile.txt > unixfile
    Linux user 439038 | Ubuntu user 20892

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •