On Thu, Jun 27, 2013 at 8:58 AM, Richard Hipp <d...@sqlite.org> wrote:

>
> What if, instead of a new command, we simply extend the ".import" command
> so that if the first character of the filename is "|" it interprets the
> filename as a pipe instead of a file.  The ".output" command works that way.
>

This alternative concept has now been implemented on trunk.  Example:

script1.awk is:

BEGIN {
  print "x,y"
  for(i=1; i<=10; i++){
     print i ",this is string " i
  }
  exit(0);
}

Then run:

drh@tallis:~/sqlite/bld$ ./sqlite3
SQLite version 3.8.0 2013-06-27 14:07:53
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .mode csv
sqlite> .import '|awk -f script1.awk' t1
sqlite> select * from t1;
1,"this is string 1"
2,"this is string 2"
3,"this is string 3"
4,"this is string 4"
5,"this is string 5"
6,"this is string 6"
7,"this is string 7"
8,"this is string 8"
9,"this is string 9"
10,"this is string 10"
sqlite>

-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to