If you edit files under Windows and then move them to a Linux server, you may encounter the problem that Windows uses \r\n as newline while Linux just uses \n. To remove the carriage return in all files ending on .sh or .SPEC use the following command:
find . -type f \( -name "*.sh" -o -name "*.SPEC" \) -exec sh -c "tr -d '\15\32' {} > {}.nn" \;
For each file found by find, a shell is executed, which again executes the tr command to drop \r. The tr command is given the current file via the {} parameter. The output of the tr command is redirected from the standard output to a new file that consists of the current file’s name ({} again} plus the ending .nn.