An SQLite/STDIN Conundrum, Specific to AIX
Posted
by mikfreedman
on Server Fault
See other posts from Server Fault
or by mikfreedman
Published on 2010-06-09T07:52:34Z
Indexed on
2010/06/09
8:02 UTC
Read the original article
Hit count: 392
Hi there!
I'm been playing around with SQlite at work, specifically with trying to get the sqlite3 command line tool to accept stdin instead of a file. Sounds easy enough, on linux you can execute a command like:
echo 'test' | sqlite3 test.db '.import /dev/stdin test'
unfortunately - our machines at work run AIX (5 & 6) and as far as I can tell, there is no equivalent to the virtual file /dev/stdin. I managed to hack together an equivalent command that works on AIX using a temporary file.
echo 'test' | cat - > /tmp/blah ; sqlite3 test.db '.import /dev/stdin test' ; rm /tmp/blah
Now, does it need to use STDIN? isn't this temporary file thing enough? Probably, but I was hoping someone with better unix-fu had a more elegant solution.
note: the data I would like to import is only provided via STDOUT, so that's what the echo 'test' command is all about
© Server Fault or respective owner