Home > other >  Pipe two command outputs into one command
Pipe two command outputs into one command

Time:01-06

I'm trying to create a batch file to make wrting code in sqlite3 easier, and I want to my file to display the table, nicely, after all the edits made. I'm using Windows 10.
Here's the code:

echo .mode columns | sqlite3 somedb.db
echo select * from blah | sqlite3 somedb.db

I want .mode columns and select * from blah to be passed(piped) into the stdin of one sqlite3 somedb.db.

CodePudding user response:

Unless you need to use a pipeline, the commands can be entered as arguments after the database name like so:

sqlite3 somedb.db ".mode columns" "select * from blah;"
  •  Tags:  
  • Related