Uppercase to lowercase using vi

:%s/.*/\L&/

Lowercase to uppercase using vi

:%s/.*/\U&/

Using tr ( depends on flavor )

 tr '[:upper:]' '[:lower:]' < file > newfile