In this video we show how to open a file with a text editor, actually, with three text editors:
TextEdit
nano
vim
With the command open, we can open a file with any chosen application. We showed how to open it with TextEdit.
open -e example.txt
nano is a simple program to edit files within macOS Terminal, and Vim has more features and can help you a lot if you are an expert.
I don't show how to use nano and vim, but maybe someday :)