{"id":3347,"date":"2019-06-22T11:41:09","date_gmt":"2019-06-22T03:41:09","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=3347"},"modified":"2019-06-30T22:56:33","modified_gmt":"2019-06-30T14:56:33","slug":"dos2unix","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/dos2unix","title":{"rendered":"dos2unix\u547d\u4ee4 – \u5c06DOS\u683c\u5f0f\u7684\u6587\u672c\u6587\u4ef6\u8f6c\u6362\u6210UNIX\u683c\u5f0f"},"content":{"rendered":"\n
dos2unix\u547d\u4ee4\u7528\u6765\u5c06DOS\u683c\u5f0f\u7684\u6587\u672c\u6587\u4ef6\u8f6c\u6362\u6210UNIX\u683c\u5f0f\u7684\uff08DOS\/MAC to UNIX text file format converter\uff09\u3002DOS\u4e0b\u7684\u6587\u672c\u6587\u4ef6\u662f\u4ee5\\r\\n\u4f5c\u4e3a\u65ad\u884c\u6807\u5fd7\u7684\uff0c\u8868\u793a\u6210\u5341\u516d\u8fdb\u5236\u5c31\u662f0D 0A\u3002\u800cUnix\u4e0b\u7684\u6587\u672c\u6587\u4ef6\u662f\u4ee5\\n\u4f5c\u4e3a\u65ad\u884c\u6807\u5fd7\u7684\uff0c\u8868\u793a\u6210\u5341\u516d\u8fdb\u5236\u5c31\u662f0A\u3002<\/p>\n\n\n\n
DOS\u683c\u5f0f\u7684\u6587\u672c\u6587\u4ef6\u5728Linux\u4e0b\uff0c\u7528\u8f83\u4f4e\u7248\u672c\u7684vi\u6253\u5f00\u65f6\u884c\u5c3e\u4f1a\u663e\u793a^M\uff0c\u800c\u4e14\u5f88\u591a\u547d\u4ee4\u90fd\u65e0\u6cd5\u5f88\u597d\u7684\u5904\u7406\u8fd9\u79cd\u683c\u5f0f\u7684\u6587\u4ef6\u3002\u5982\u679c\u662f\u4e2ashell\u811a\u672c\uff0c\u800cUnix\u683c\u5f0f\u7684\u6587\u672c\u6587\u4ef6\u5728Windows\u4e0b\u7528Notepad\u6253\u5f00\u65f6\u4f1a\u62fc\u5728\u4e00\u8d77\u663e\u793a\u3002\u56e0\u6b64\u4ea7\u751f\u4e86\u4e24\u79cd\u683c\u5f0f\u6587\u4ef6\u76f8\u4e92\u8f6c\u6362\u7684\u9700\u6c42\uff0c\u5bf9\u5e94\u7684\u5c06UNIX\u683c\u5f0f\u6587\u672c\u6587\u4ef6\u8f6c\u6210\u6210DOS\u683c\u5f0f\u7684\u662funix2dos\u547d\u4ee4\u3002<\/p>\n\n\n\n
\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>dos2unix [\u53c2\u6570] [\u6587\u4ef6] <\/p>\n\n\n\n \u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n \u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n \u6700\u7b80\u5355\u7684\u7528\u6cd5\u5c31\u662fdos2unix\u76f4\u63a5\u8ddf\u4e0a\u6587\u4ef6\u540d\uff1a<\/p>\n\n\n\n \u5982\u679c\u4e00\u6b21\u8f6c\u6362\u591a\u4e2a\u6587\u4ef6\uff0c\u628a\u8fd9\u4e9b\u6587\u4ef6\u540d\u76f4\u63a5\u8ddf\u5728dos2unix\u4e4b\u540e\u3002\uff08\u6ce8\uff1a\u4e5f\u53ef\u4ee5\u52a0\u4e0a-o\u53c2\u6570\uff0c\u4e5f\u53ef\u4ee5\u4e0d\u52a0\uff0c\u6548\u679c\u4e00\u6837\uff09<\/p>\n\n\n\n \u4e0a\u9762\u5728\u8f6c\u6362\u65f6\uff0c\u90fd\u4f1a\u76f4\u63a5\u5728\u539f\u6765\u7684\u6587\u4ef6\u4e0a\u4fee\u6539\uff0c\u5982\u679c\u60f3\u628a\u8f6c\u6362\u7684\u7ed3\u679c\u4fdd\u5b58\u5728\u522b\u7684\u6587\u4ef6\uff0c\u800c\u6e90\u6587\u4ef6\u4e0d\u53d8\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528-n\u53c2\u6570\u3002<\/p>\n\n\n\n \u5982\u679c\u8981\u4fdd\u6301\u6587\u4ef6\u65f6\u95f4\u6233\u4e0d\u53d8\uff0c\u52a0\u4e0a-k\u53c2\u6570\u3002\u6240\u4ee5\u4e0a\u9762\u51e0\u6761\u547d\u4ee4\u90fd\u662f\u53ef\u4ee5\u52a0\u4e0a-k\u53c2\u6570\u6765\u4fdd\u6301\u6587\u4ef6\u65f6\u95f4\u6233\u7684\u3002<\/p>\n\n\n\n <\/p>\n","protected":false},"excerpt":{"rendered":" dos2unix\u547d\u4ee4\u7528\u6765\u5c06DOS\u683c\u5f0f\u7684\u6587\u672c\u6587\u4ef6\u8f6c\u6362\u6210UNIX\u683c\u5f0f\u7684\uff08DOS\/MAC to UNIX text […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/3347"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=3347"}],"version-history":[{"count":15,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/3347\/revisions"}],"predecessor-version":[{"id":3758,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/3347\/revisions\/3758"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=3347"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=3347"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=3347"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}-k<\/td> \u4fdd\u6301\u8f93\u51fa\u6587\u4ef6\u7684\u65e5\u671f\u4e0d\u53d8<\/td><\/tr> -q<\/td> \u5b89\u9759\u6a21\u5f0f\uff0c\u4e0d\u63d0\u793a\u4efb\u4f55\u8b66\u544a\u4fe1\u606f<\/td><\/tr> -V<\/td> \u67e5\u770b\u7248\u672c<\/td><\/tr> -c<\/td> \u8f6c\u6362\u6a21\u5f0f\uff1aASCII 7bit ISO Mac<\/td><\/tr> -o<\/td> \u5199\u5165\u5230\u6e90\u6587\u4ef6<\/td><\/tr> -n<\/td> \u5199\u5165\u5230\u65b0\u6587\u4ef6<\/td><\/tr><\/tbody><\/table>\n\n\n\n [root@linuxcool ~]# dos2unix file<\/pre>\n\n\n\n
[root@linuxcool ~]# dos2unix file1 file2 file3\n[root@linuxcool ~]# dos2unix -o file1 file2 file3<\/pre>\n\n\n\n
[root@linuxcool ~]# dos2unix -n oldfile newfile<\/pre>\n\n\n\n
[root@linuxcool ~]# dos2unix -k file\n[root@linuxcool ~]# dos2unix -k file1 file2 file3\n[root@linuxcool ~]# dos2unix -k -o file1 file2 file3\n[root@linuxcool ~]# dos2unix -k -n oldfile newfile<\/pre>\n\n\n\n