Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7629335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:48:38+00:00 2026-05-31T05:48:38+00:00

mohpc04pp1: /h/u544835 % psql arco Welcome to psql 8.1.17, the PostgreSQL interactive terminal. Type:

  • 0
mohpc04pp1: /h/u544835 % psql arco
Welcome to psql 8.1.17, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
   \h for help with SQL commands
   \? for help with psql commands
   \g or terminate with semicolon to execute query
   \q to quit

WARNING:  You are connected to a server with major version 8.3,
but your psql client is major version 8.2.  Some backslash commands,
such as \d, might not work properly.

dbname=> \o /h/u544835/data25000.csv
dbname=> select url from urltable where scoreid=1 limit 25000;
dbname=> \q

This is took from a link online of basically what I have been doing, but what I need to do is make a script that I can use to produce csv files daily

So my aim of the script is to while in the script connect to the db, run the \o etc commands then close it

but I’m having trouble scripting it to say go into the psql arco database then run those queries.

command line to connect to db = psql arco then once the scrits recognised I’m in that databse perform those commands to automate a query to a csv file.

if anyone can get me started or point me towards reading material for me to get past that bit, it will be duely appreciated.

i’m running all this off a standard windows xp, ssh’ing to a SLES set-up web server that holds my postgresql database running psql version 8.1.17

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:48:40+00:00Added an answer on May 31, 2026 at 5:48 am

    Thanks to Erwin’s help and a link I read up on he posted for me I managed to combine the two to get

    #!/bin/sh
    
    dbname='arco'
    username=''   # If you actually supply a username, you need to add the -U switch!
    psql $dbname $username << EOF
    \f ,
    \o /h/u544835/showme.csv
    SELECT * FROM storage;
    EOF
    

    which will write my queries to a csv file etc for me.

    From what there is above, it is not separating the sql query so if I load it straight into excel, they all stay in the same column too which means I’m having a problem with the delimiter

    I’ve tried tabbed delimiters, also tried , ; etc but none are letting me separate it
    I need for it
    is there an option I can click to see which delimiter is being used with my psql? or a different way of dumping the data from a query into a file that can be read by excel, so a different column for each row etc

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.