zoukankan      html  css  js  c++  java
  • dos和unix文本转化


    一 unix/linux 命令

    unix2dos - UNIX to DOS text file format converter  

    EXAMPLES

    Get input from stdin and write output to stdout.

    unix2dos

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

    unix2dos a.txt b.txt

    unix2dos -o a.txt b.txt

    Convert and replace a.txt in ASCII conversion mode. Convert and replace b.txt in ISO conversion mode.

    unix2dos a.txt -c iso b.txt

    unix2dos -c ascii a.txt -c iso b.txt

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

    unix2dos -k a.txt

    unix2dos -k -o a.txt

    Convert a.txt and write to e.txt.

    unix2dos -n a.txt e.txt

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

    unix2dos -k -n a.txt e.txt

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

    unix2dos a.txt -n b.txt e.txt

    unix2dos -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.

    unix2dos -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt

    dos2unix - DOS/MAC to UNIX text file format converter

    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. Convert and replace b.txt in ISO conversion mode. Convert c.txt from Mac to Unix ascii format.

    dos2unix a.txt -c iso b.txt

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

    dos2unix -c mac a.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

     二 perl脚本

    dos2unix.pl

    my $file = shift;

    if (-$file)
    {
      
    open IN, "< $file";
      
    @DOSFILE = <IN>;
      
    close IN;
      
    chomp @DOSFILE;
    }
    else
    {
      
    print "$file is NOT writable\n";
      
    exit 1;
    }

    open OUT, "> $file";
    binmode OUT;

    foreach (@DOSFILE)
    {
      
    print OUT $_;
      
    print OUT "\012";
    }

    close OUT;

     unix2dos.pl


    my $file = shift;

    if (-$file)
    {
      
    open IN, "< $file";
      
    @DOSFILE = <IN>;
      
    close IN;
      
    chomp @DOSFILE;
    }
    else
    {
      
    print "$file is NOT writable\n";
      
    exit 1;
    }

    open OUT, "> $file";
    binmode OUT;

    foreach (@DOSFILE)
    {
      
    print OUT $_;
      
    print OUT "\r\n";
    }

    close OUT;

    三 其他工具Tofrodos

     http://www.thefreecountry.com/tofrodos/index.shtml

    完!


    作者:iTech
    微信公众号: cicdops
    出处:http://itech.cnblogs.com/
    github:https://github.com/cicdops/cicdops

  • 相关阅读:
    Atom实例
    订阅基础:RSS、ATOM、FEED、聚合、供稿、合烧与订阅
    XML模式:Dublin Core
    Dublin Core
    海量数据的理想存储方案
    百亿级别数据量,又需要秒级响应的案例,需要什么系统支持呢?下面介绍下大数据实时分析工具Yonghong Z-Suite
    用HiveDB横向切分MySQL数据库
    超详细单机版搭建hadoop环境图文解析
    从String.valueOf(null)说起
    js闭包理解
  • 原文地址:https://www.cnblogs.com/itech/p/1605371.html
Copyright © 2011-2022 走看看