Client APIs
Reading from stdin and Writing to stdout
When in a Unix environment, it can be useful to pipe data between multiple commands.
DuckDB is able to read data from stdin as well as write to stdout using the file location of stdin (` /dev/stdin`) and stdout (` /dev/stdout`) within SQL commands, as pipes act very similarly to file handles.  
This command will create an example CSV:  
```sql
COPY (SELECT 42 AS woot UNION ALL SELECT 43 AS woot) TO 'test.csv' (HEADER);
```  
First, read a file and pipe it to the `duckdb` CLI executable. As arguments to the DuckDB CLI, pass in the location of the database to open, in this case, an in-memory database, and a SQL command that utilizes `/dev/stdin` as a file location.  
```bash
cat test.csv | duckdb -c "SELECT * FROM read_csv('/dev/stdin')"
```  
| woot |
|-----:|
| 42   |
| 43   |  
To write back to stdout, the copy command can be used with the `/dev/stdout` file location.  
```bash
cat test.csv | \
duckdb -c "COPY (SELECT * FROM read_csv('/dev/stdin')) TO '/dev/stdout' WITH (FORMAT 'csv', HEADER)"
```  
```csv
woot
42
43
```