CRLF conversion for windows and linux Files

Source: Internet
Author: User

CRLF conversion for windows and linux Files
1. CRLFCRLF -- Carriage-Return Line-Feed press enter to wrap the Line.
CR: Press enter, ASCII 13, \ r, LF: line feed, LF, ASCII 10, \ n. Use \ r \ n for windows and \ n for linux. Windows disconnection character ^ M $. in linux, only $ can be executed if the shell file in linux contains ^ M characters. Remove \ r. 2. The dos2unix and unix2dosdos2unix and unix2dos commands are used to convert CRLF.

dos2unix -kn file newfile
-K keep the source file mtime-n keep the old file, and the conversion result is output to the new file. 3. Use the example test file created in windows.
# Test is A windows File $ cat-A testbaidu ^ M $ google ^ M $ # convert to linux $ dos2unix-k-n test. linuxdos2unix: converting file test to file test. linux in UNIX format... # The file size is inconsistent because the viewing time is the same. $ ll-rw-r -- 1 work 15 Aug 9 test-rw ------- 1 work 13 Aug 9 test. linux # cat-A view $ cat-A test. linux baidu $ google $ # convert unix to windows $ unix2dos test. linux unix2dos: converting file test. linux to DOS format... # view the size and time $ ll-rw-r -- 1 work 15 Aug 9 test-rw ------- 1 work 15 Aug 9 test. linux
Address: http://blog.csdn.net/yonggang7/article/details/38459143

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.