Username: Password:

dos2unix 命令
来源: ChinaUnix博客  作者: 发布时间:2008-04-25 04:03:49


这是个很简单的命令.功能是将DOS/MAC下的文档转化为UNIX的文本文档格式.用法详见下面.
就是这样一个简单的命令折腾了我大半天.我在用mysql查询数据库,执行的批处理放在了一个文档里.假如我执行这个文档,那个存放查询结果的文档名字总是在后面附加一个?号.而假如我一行一行敲入命令,执行就正常.而且比较了两个文档后没有差别.更有一个奇怪的事情就是总是出现一个类似"quit"出现mysql语法错误的提示.这个奇怪的现象使我很困惑.后来在一位老大的帮助下想到了是不是由于文档格式的差别.因为我这个文档在windows下编辑过,后来一试,果然很灵啊.

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


喜欢本文,那就收藏到:

    Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪ViVi 365Key网摘 天极网摘 和讯网摘 博拉网 POCO网摘 添加到饭否 QQ书签 Digbuzz我挖网
相关评论  我也要评论
还没有关于此文章的相关评论!
  • 昵称: (为空则显示guest)
  • 评论分数: ★ ★ ★★★ ★★★★ ★★★★★
  • 评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
  • 导航
    赞助商
    文章类别
    订阅