0

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

Viktor Khilin
  • 1,760
  • 9
  • 21
zyzzino
  • 1
  • 3
  • 1
    Possible duplicate of [How to remove a character at the end of each line in unix](https://stackoverflow.com/questions/14840953/how-to-remove-a-character-at-the-end-of-each-line-in-unix) – Davide Spataro Jan 18 '18 at 14:40

1 Answers1

1

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

g in the end of sed command forgotten.

Viktor Khilin
  • 1,760
  • 9
  • 21