Can a file be inserted to a mysql table from a unix(linux) command prompt?

Also, can I query the same table and output the data to a filename.ext in a specified directory?