trdsql can receive data from standard input like other UNIX tools. However, you need to specify the table name in SQL syntax. When using standard input, use “-” or “stdin”.
cat test.csv|trdsql -icsv "SELECT * FROM -"
apple,100orange,50potato,30
Details
trdsql receives standard input, but the execution of SQL starts after all standard input is received.
Therefore, you cannot receive output from a command that does not end.
Commands that output CSV, LTSV, and JSON can be used directly by using standard input instead of a file name.
For example, you can use it as it is by changing the character code to UTF-8 from a file that is not UTF-8, or
nkf -w sjis.csv|trdsql -icsv "SELECT * FROM -"
You can also try processing only the first few lines before processing a large file.
head -100 big.csv|trdsql -icsv "SELECT * FROM -"
In addition, there are many commands that output data that can be treated as table data if interpreted as a space-separated output in UNIX commands.