I have a simple question, but I can't find an answer )
I have following script:
sqsh -S SyBaseServer -U sybuser -P mypass -C 'select top 10000 * from dba.sybtable; -mbcp' | \
awk '{print substr($0, 0, length($0)-1)}' | \
psql -1 postgresql://admin:adminpass@pgserv:5432/pgbase -f sybtopg.sql
How can I add EOF after last string of ouput of awk? I must close STDIN for psql.
Thanks!
PS The reason of fail isn't lack of EOF. It's right pipeline:
sqsh -S SyBaseServer -U sybuser -P mypass -C 'select top 10000 * from dba.wybtable; -mbcp' \
| awk '{print substr($0, 0, length($0)-1)}' | \
/psql postgresql://admin:adminpass@pgserv:5432/pgbase -c "DELETE FROM testtable; COPY testtable FROM STDIN DELIMITER '|' CSV"