Omg.. for years on linux & then macos I've been doing cat file.txt
and then copying it from the terminal into the clipboard.
I just learned on macos you can use pbcopy
like so
cat sample.txt | pbcopy
to get the file contents directly in your clipboard.
This works for command outputs as well. If you just want the file directly you can run pbcopy < sample.txt