zyzzino
zyzzino

Reputation: 1

How to remove pipe at end of each line of a .dat file in linux

I have a .dat file similar to example below:

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

any idea how I can remove the pipe '|' at the end of the line and save it?

I have tried sed 's/.$//' file > file.nolast

Upvotes: 0

Views: 826

Answers (1)

sahaquiel
sahaquiel

Reputation: 1838

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

g in the end of sed command forgotten.

Upvotes: 1

Related Questions