linux - 如何在 Linux 中删除 .dat 文件每一行末尾的管道

标签 linux unix

我有一个类似于以下示例的 .dat 文件:

1|sam  |test|
2|eric |test|
3|james|test|

知道如何删除管道 '|'在行尾并保存?

我试过 sed 's/.$//' file > file.nolast

最佳答案

sed 's/.$//g' 文件 > file.nolast

gsed 命令的末尾忘记了。

关于linux - 如何在 Linux 中删除 .dat 文件每一行末尾的管道,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48323765/

相关文章:

linux - Vagrant 在访客计算机中创建多个终端

php - 防止 sed 扩展变量

node.js - 以编程方式编辑 unix 主机文件

bash - 在脚本之间发送信号(bash)

linux - 无法安装 mono-gmcs 包

linux - Azure Linux VM 的 SSH 超时

c++ - fstream open 在处理大文件时有问题吗?

unix - 如何检查 UNIX 上特定端口是打开还是关闭?

Linux命令查看两个或多个打开终端的历史记录?

linux - 猫重定向自动杀死?