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

如何在linux中删除.dat文件每行末尾的管道,linux,unix,Linux,Unix,我有一个.dat文件,类似于下面的示例: 1|sam |test| 2|eric |test| 3|james|test| 你知道我该如何移除管线末端的管道“|”并保存它吗 我尝试了sed的/$//'file>file.nolastsed的/$///g'file>file.nolast g在sed命令末尾被遗忘。可能重复的

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

1|sam  |test|
2|eric |test|
3|james|test|
你知道我该如何移除管线末端的管道“|”并保存它吗

我尝试了sed的/$//'file>file.nolast

sed的/$///g'file>file.nolast

g在sed命令末尾被遗忘。

可能重复的