stripping last character from end of each line

Hi, sorry for being dumb but I have a file with a variable amount of records (day to day it differs) but is fixed at 80 characters wide. Unfortunately the 80th and last charachter in each line is a "^M" carriage return character which i want to get rid of. Is there a really easy command that i can use to strip this character off the end of each line (as i say the number of lines is totally variable)

any help would be greatly appreciated
Gary

The command you want is called "dos2unix" although depending on your system may be called "dos2ux" or "dos2aix" etc.

Are there no other ways to do this besides installing a program, I need something as well at the Unix end shell script wise

You could use sed, something like:-

sed 's/^M$//' file.txt > newfile.txt (Ctrl-v, then enter for ^M character)

or if the record-length's always going to be invariable, you could use cut.

Simple and effective:

strings filename > filename.new; mv filename.new filename

thanks for that, I tried it this morning and it's just the job...many thanks to all....

you may use the sed to work it out.here is an example.

echo "which is"|sed -e 's/[a-z]$//g'

this will take out the last character.

thanks.