As per title I need to import a load of csv files. So I wrote a bash script to generate the statements I needed (attached). However, this is failing on my ubuntu laptop - it seems to occasionally miss the semicolon to execute. What I did was copy the text to clipboard and paste it in to bash. Is there maybe a way to open this file and evaluate it within psql? Output shown below:
COPY 11340
postgres=# copy postcode_input from '/home/andyt/projects/django-stringer/Other/codepo_gb/Data/ub.csv' using delimiters ','
postgres-# copy postcode_input from '/home/andyt/projects/django-stringer/Other/codepo_gb/Data/wa.csv' using delimiters ',';
ERROR: syntax error at or near "copy"
LINE 2: copy postcode_input from '/home/andyt/projects/django-string...
^
postgres=#
postgres=# copy postcode_input from '/home/andyt/projects/django-stringer/Other/codepo_gb/Data/w.csv' using delimiters ',';
COPY 19787
postgres=#
postgres=# copy postcode_input from '/home/andyt/projects/django-stringer/Other/codepo_gb/Data/wf.csv' using delimiters ','
postgres-# copy postcode_input from '/home/andyt/projects/django-stringer/Other/codepo_gb/Data/wn.csv' using delimiters ',';
ERROR: syntax error at or near "copy"
LINE 2: copy postcode_input from '/home/andyt/projects/django-string...
^
postgres=# copy postcode_input from '/home/andyt/projects/django-stringer/Other/codepo_gb/Data/wr.csv' using delimiters ',';
COPY 8381
postgres=# copy postcode_input from '/home/andyt/projects/django-stringer/Other/codepo_gb/Data/ws.csv' using delimiters ',';
COPY 9884
postgres=# copy postcode_input from '/home/andyt/projects/django-stringer/Other/codepo_gb/Data/wv.csv' using delimiters ',';
COPY 9440