How to remove comma from the last line of the file

Hi,

I have a file which has records which end with a comma.

for example:

My file looks like

1234,
5678,
3455,
3566,
4444,
9999,

I need to remove comma for the last line in the file so that my file should look like:

1234,
5678,
3455,
3566,
4444,
9999

How can we do this?

Thanks
Sandeep

sed  '$s/,$//' filename

Jim,

If i use this its removing comma from each line and the result looks like this:

1234
5678
3455
3566
4444
9999

I want to only remove comma for the last line of the file.

Thanks
Sandeep

sed  '$s/,$//' filename
1234,
5678,
3455,
3566,
4444,
9999

This is what I get.....

sed '$,$ {
s/,$//
}' file

Jim,

My bad, i was not putting $ before s. I mean i was using sed 's/,$//' filename.

Now its works exactly i intended if i use your code sed '$s/,$//' filename

Thanks for your reply and you were right.