Solved How to delete last charecter from a file

August 21, 2012 at 05:26:46
Specs: Windows 7
Hi,

I have one file with data as
789., 980.,
I want to delete the last comma from this.
I tried
sed '$s/,$//' file1.txt >newfile.txt
But newfile.txt is empty after running this command.

Please help me.

Thanks,



See More: How to delete last charecter from a file

Report •

#1
August 21, 2012 at 09:58:00
✔ Best Answer

sed '$s/ *\([,]\)$//' file1.txt

Report •
Related Solutions


Ask Question