How to change Windows/DOS line breaks to Unix style with Vi

I had a file that was edited in Windows, so it had CRLF line breaks. It was a script and I had to change the line breaks to LF before I could run the script in bash.

I converted the line breaks to Unix style using the vi editor and running these two commands:

:e ++ff=dos
:set ff=unix

The first command will instruct vi to read the file again and force it to a DOS format. Then the second command sets the file format to Unix.

After the conversion I saved the file with :wq