pbpaste

Send the contents of the clipboard to stdout. Comparable to pressing Cmd + V on the keyboard. More information: https://keith.github.io/xcode-man-pages/pbpaste.1.html.

pbpaste > path/to/file

pbpaste | grep foo