UNIXtextfile轉(zhuǎn)換aptitudeinstallsysutils行末:D" />

亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

dos2unix和unix2dos命令使用 - [〓 腳本功略 〓

系統(tǒng) 3388 0

dos2unix和unix2dos命令使用 - ★〓 無(wú)用的天地 〓★ - 博客大巴

dos2unix和unix2dos命令使用 - [ 〓 腳本功略 〓 ]

2008-04-20

版權(quán)聲明 :轉(zhuǎn)載時(shí)請(qǐng)以超鏈接形式標(biāo)明文章原始出處和作者信息及 本聲明
http://solecjj.blogbus.com/logs/19425369.html

dos2unix, unix2dos 用來(lái)實(shí)現(xiàn) DOS <=> UNIX text file 轉(zhuǎn)換
aptitude install sysutils
行末:
DOS 格式 0d 0a
UNIX 格式 0a

可用功能相同的指令組合
dos2unix:
sed -i'' "s/\r//" file

cat file | col -b > newfile

cat file | tr -d "\r" > newfile

cat file | tr -d "\015" > newfile

unix2dos:
sed -i'' "s/$/\r/" file

sed -i'' "s/$/\x0d/" file

-i后面的是單引號(hào)組成

以上適用 GNU sed, FreeBSD 下的 sed 不適用


------------------------------------------


dos2unix 命令


這是一個(gè)很簡(jiǎn)單的命令.功能是將DOS/MAC下的文件轉(zhuǎn)化為UNIX的文本文件格式.用法詳見(jiàn)下面.
就是這樣一個(gè)簡(jiǎn)單的命令折騰了我大半天.我在用mysql查詢數(shù)據(jù)庫(kù),執(zhí)行的批處理放在了一個(gè)文件里.如果我執(zhí)行這個(gè)文件,那個(gè)存放查詢結(jié)果的 文件名字總是在后面附加一個(gè)?號(hào).而如果我一行一行敲入命令,執(zhí)行就正常.而且比較了兩個(gè)文件后沒(méi)有差別.還有一個(gè)奇怪的事情就是總是出現(xiàn)一個(gè)類似 "quit"出現(xiàn)mysql語(yǔ)法錯(cuò)誤的提示.這個(gè)奇怪的現(xiàn)象使我很困惑.后來(lái)在一位老大的幫助下想到了是不是由于文件格式的差別.因?yàn)槲疫@個(gè)文件在 windows下編輯過(guò),后來(lái)一試,果然很靈啊.


SYNOPSYS
?????? dos2unix [options] [-c convmode] [-o file ...] [-n infile outfile ...]
?????? Options:
?????? [-hkqV] [--help] [--keepdate] [--quiet] [--version]


DESCRIPTION
?????? dos2unix, the program that converts plain
?????? text files in DOS/MAC format to UNIX format.

OPTIONS
?????? The following options are available:

?????? -h --help
????????????? Print online help.


?????? -k --keepdate
????????????? Keep the date stamp of output file same as input file.


?????? -q --quiet
????????????? Quiet mode. Suppress all warning and messages.


?????? -V --version
????????????? Prints version information.


?????? -c --convmode convmode
????????????? Sets conversion mode. Where convmode is one of: ASCII, 7bit,
????????????? ISO, Mac with ASCII being the default. Simulates dos2unix under
????????????? SunOS.
-o --oldfile file ...
????????????? Old file mode. Convert the file and write output to it. The pro-
????????????? gram default to run in this mode. Wildcard names may be used.


?????? -n --newfile infile outfile ...
????????????? New file mode. Convert the infile and write output to outfile.
????????????? File names must be given in pairs and wildcard names should NOT
????????????? be used or you WILL lost your files.


EXAMPLES
?????? Get input from stdin and write output to stdout.

????????????? dos2unix


?????? Convert and replace a.txt. Convert and replace b.txt.

????????????? dos2unix a.txt b.txt

????????????? dos2unix -o a.txt b.txt


?????? Convert and replace a.txt in ASCII conversion mode.
dos2unix a.txt -c iso b.txt


?????? Convert and replace b.txt in ISO conversion mode.

????????????? dos2unix -c ascii a.txt -c iso b.txt


?????? Convert c.txt from Mac to Unix ascii format.


????????????? dos2unix -c mac c.txt b.txt


?????? Convert and replace a.txt while keeping original date stamp.

????????????? dos2unix -k a.txt

????????????? dos2unix -k -o a.txt


?????? Convert a.txt and write to e.txt.

????????????? dos2unix -n a.txt e.txt


?????? Convert a.txt and write to e.txt, keep date stamp of e.txt
same as
?????? a.txt.

????????????? dos2unix -k -n a.txt e.txt


?????? Convert and replace a.txt. Convert b.txt and write to e.txt.

????????????? dos2unix a.txt -n b.txt e.txt

????????????? dos2unix -o a.txt -n b.txt e.txt


?????? Convert c.txt and write to e.txt. Convert and replace a.txt. Convert
?????? and replace b.txt. Convert d.txt and write to f.txt.

????????????? dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt

dos2unix和unix2dos命令使用 - [〓 腳本功略 〓]


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 天天撸天天操 | 国产日韩欧美亚洲综合首页 | 国产高清看片日韩欧美久久 | 亚洲五月综合网色九月色 | 国产羞羞事1000部在线观看 | 久久久全国免费视频 | 国产99视频精品草莓免视看 | 在线观看视频中文字幕 | 久热这里只有精品在线 | 国产欧美精品一区aⅴ影院 国产欧美精品一区二区 | 国产精品福利在线观看 | 日日操狠狠操 | 黄片123| 台湾佬中文娱乐2222vvv | 国产精品免费视频播放 | 日韩精品一区二区三区 在线观看 | 天天综合在线视频 | 久久综合综合久久 | 思思久久这里只精品99re66 | 久久久久综合精品福利啪啪 | 久久精品在现线观看免费15 | 成人亚洲欧美日韩中文字幕 | 久久精品国产400部免费看 | 成人91视频| 欧美久久一区二区 | 亚洲精品美女久久777777 | 日本吻胸抓胸激烈视频网站 | 国产成人精品免费久久久久 | 99香蕉视频| 男人天堂网在线观看 | 97人人在线 | 亚洲美女视频在线观看 | 欧美性猛交xxxxx按摩欧美 | 麻豆日韩 | 日韩综合久久 | 欧美精品成人一区二区视频一 | 99久久精品无码一区二区毛片 | 亚洲国产99在线精品一区69堂 | 日韩第三页 | 亚洲精品69 | 欧美一区二区三区视视频 |