I want to dump a select query to a tab-delimited text file using psql -F. However, this doesn’t work:
psql -Umyuser mydb -F '\t' --no-align -c "select * from mytable" -o /tmp/dumpfile.txt
That makes the delimiter a literal \t. How do I get it to use real tabs instead?
I think you just need to use a literal tab. How this works depends on your shell. Have you seen this post?
In the bash shell you can do this with
$'\t'.Using the example in your question:
From
man bash: