【问题标题】:.csv not displayed properly in the terminal.csv 未在终端中正确显示
【发布时间】:2017-03-05 18:23:51
【问题描述】:

当我进入时

more trap10c_7C000000395C1641_160823.csv

我得到以下输出:

3/14/16 22:00,23.5ature (�C)0.024
3/15/16 16:00,29.5
3/16/16 11:00,39.5
3/17/16 5:00,21.55
3/17/16 23:00,24.5
3/18/16 17:00,28.5
3/19/16 11:00,2855
3/20/16 5:00,23.55
3/20/16 23:00,25.5
3/21/16 17:00,29.5
3/22/16 10:00,26.5
3/23/16 5:00,22.55
3/23/16 23:00,24.5

...等

当我在 libreoffice 或 textedit 中打开文件时,我得到这个:

,8/23/16
Timezone,-6

Serial No.,3300000039575B41
Location:,LS_trap_6u
High temperature limit (°C),20.1
Low temperature limit (°C),0.03
Date - Time,Temperature (°C)
3/13/16 9:59,26.6
3/13/16 10:59,28.6
3/13/16 11:59,28.6
3/13/16 12:59,27.6
3/13/16 13:59,26.1
3/13/16 14:59,25.6
3/13/16 15:59,26.1
3/13/16 16:59,25.6
3/13/16 17:59,24.6
3/13/16 18:59,24.6

在其他程序中打开该文件时,该文件有一个标题,并且在 more 的输出中似乎缺少数据。我有许多其他类似的文件,它们更多地显示与其他程序相同的信息。 命令dos2unix trap10c_7C000000395C1641_160823.csv 似乎没有改变任何东西

wc -l

表示文件中有 0 行。我无法破译。为什么数据会有差异?

【问题讨论】:

  • 你有一些疯狂的编码 - 尝试运行 file trap10c* 看看你有什么格式。
  • 这会导致:trap10c_7C000000395C1641_160823.csv: ISO-8859 text, with CR line terminators
  • 尝试使用iconv将其转换为UTF-8或ASCII...f15ijp.com/2010/02/…
  • 当我对其他一些文件执行 file 时,它不会输出“带有 CR 行终止符”,它只是说 ISO-8859 text。这可能是问题吗?

标签: excel bash csv


【解决方案1】:

我这样解决了这个问题: mac2unix trap10c_7C000000395C1641_160823.csv

完成后,文件在终端中输出正常。它删除了 CR 线路终结器。

【讨论】:

    猜你喜欢
    • 2018-09-16
    • 1970-01-01
    • 2022-10-18
    • 1970-01-01
    • 2018-10-01
    • 2018-12-02
    • 1970-01-01
    • 2011-06-14
    • 1970-01-01
    相关资源
    最近更新 更多