Dos2unix - Linux命令 - UNIX命令

Linux / Unix命令dos2unix


名称

dos2unix - DOS / MAC到UNIX 文本文件格式转换器

概要

dos2unix [options] [-c convmode] [-o文件...] [-n infile outfile ...]

选项:

[-hkqV] [--help] [--keepdate] [--quiet] [--version]

描述

本手册页面介绍dos2unix,这是将DOS / MAC格式的纯文本文件转换为UNIX格式的程序。

选项

以下选项可用:

-h - 帮助

打印在线帮助。

-k --keepdate

保持输出文件的日期标记与输入文件相同。

-q - 安静

静音模式。 禁止所有警告和消息。

-V - 版本

打印版本信息。

-c --convmode convmode

设置转换模式。 在SunOS下模拟dos2unix。

-o --oldfile文件...

旧文件模式。 转换文件并将输出写入它。 程序默认以这种模式运行。 可以使用通配符名称。

-n --newfile infile outfile ...

新文件模式。 将infile和write输出转换为outfile。 文件名必须成对出现,不应使用通配符名称,否则将丢失文件。

例子

从stdin获取输入并将输出写入stdout。

DOS2UNIX的

转换并替换a.txt。 转换并替换b.txt。

dos2unix a.txt b.txt

dos2unix -o a.txt b.txt

在ASCII转换模式下转换并替换a.txt。 在ISO转换模式下转换并替换b.txt。 将c.txt从Mac转换为Unix ascii格式。

dos2unix a.txt -c iso b.txt

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

dos2unix -c mac a.txt b.txt

在保留原始日期戳的同时转换并替换a.txt。

dos2unix -k a.txt

dos2unix -k -o a.txt

转换a.txt并写入e.txt。

dos2unix -n a.txt e.txt

转换a.txt并写入e.txt,保持e.txt的日期戳记与a.txt相同。

dos2unix -k -n a.txt e.txt

转换并替换a.txt。 转换b.txt并写入e.txt。

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

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

转换c.txt并写入e.txt。 转换并替换a.txt。 转换并替换b.txt。 转换d.txt并写入f.txt。

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

重要提示:使用man命令( %man )查看特定计算机上的命令使用方式。