查看行结束在一个文本文件 [英] View line-endings in a text file

查看:124
本文介绍了查看行结束在一个文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用的东西在bash给我看行结束印刷,而不是PTED间$ P $的文件。该文件是从SSIS / SQL服务器转储由一台Linux机器加工被读入。

I'm trying to use something in bash to show me the line endings in a file printed rather than interpreted. The file is a dump from SSIS/SQL Server being read in by a Linux machine for processing.

有没有在更多等?

在除了看到线路的结局,我需要知道什么类型的线路到底是(CRLF或LF)。

In addition to seeing the line-endings, I need to know what type of line end it is (CRLF or LF).

推荐答案

您可以使用文件工具来给你行结束类型的指示。

You can use the file utility to give you an indication of the type of line endings.

Unix的:

$ file testfile1.txt
testfile.txt: ASCII text

DOS:

$ file testfile2.txt
testfile2.txt: ASCII text, with CRLF line terminators

要转换DOSUnix的:

To convert from "DOS" to Unix:

$ dos2unix testfile2.txt

从UNIX转换为DOS:

To convert from Unix to "DOS":

$ unix2dos testfile1.txt

转换已经转换的文件没有影响,所以它的安全运行盲目的(即不先试的格式),虽然通常免责声明适用,一如既往。

Converting an already converted file has no effect so it's safe to run blindly (i.e. without testing the format first) although the usual disclaimers apply, as always.

这篇关于查看行结束在一个文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆