Need Help _ Unix Script

view story

http://www.unix.com – Hello, I have one requirement. We are getting fixed length file with trailer record on it. We need to cleanse,validate and process the file. As part of validation we have to do duplicate file check based on file name and trailer record. I want to add the file name as last column to file, so that I can use the filed for validation purpose. Also I have notice that the file is coming with "^M" at the end, which my guess is windows new line character . I have to eliminate this from the file. Please help me getting this done. (HowTos)