excel - 删除 excel、csv 或文本文件中的空白

标签 excel csv unix sed tr

我有一个 Excel 文件,其中包含运行者到达 9 次中间检查的时间。因此,每个参与者的总次数为 9,但实际时间之间的许多条目都是空白。如何删除每一列中的空格?

enter image description here

我尝试转换为 txt 并执行以下操作,但没有成功,因为列时间之间不再有任何分隔:

tr -d ' ' < input.txt > no-spaces.txt
tr -d '[:blank:]' < input.txt > no-spaces.txt
tr -d '[:space:]' < input.txt > no-spaces.txt

https://askubuntu.com/questions/537956/sed-to-delete-blank-spaces

我想要的是如下内容:

enter image description here

最佳答案

使用 VBA,您可以:

Sub deleteBlanks()
    Columns("A:Z").SpecialCells(xlCellTypeBlanks).Delete Shift:=xlUp
End Sub

之前:

enter image description here

之后:

enter image description here

或者您可以使用自动筛选器,这样您就可以隐藏每列中的空白行...然后您可以选择区域,然后复制并粘贴为值。

关于excel - 删除 excel、csv 或文本文件中的空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42030053/

相关文章:

python - 如何发送带附件的电子邮件?

php - mysql -- 奇怪的 mysql varchar 到 excel

excel - 将存储为文本的数字转换为数字?

javascript - 读取 CSV 后数组的最大长度(JavaScript)

javascript - 使用 python 为基于 Web 的 ubuntu 终端编写伪终端

regex - R 中的 LEFT 加 FIND 函数相当于什么?

python - 编辑打开的 csv 文件

linux - 在文本文件的第一行之后添加定义的变量

c - 使用 newlib 和 gcc 进行路由套接字(unix 网络编程)

python - 将字符串列表写入 csv