psql output without return \n


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting psql output without return \n
# 8  
Old 04-09-2010
cool.. finally you figured it Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

PSQL multiple queries output to file

Hi, I have a shell script containing multiple PSQL queries for which I want the output to be redirected to a text file. psql -U postgres -d database -o textfile.txt << EOF Query1; Query2; Query ....; EOF When executing the script, queries outputs are directed to textfile.txt, however... (2 Replies)
Discussion started by: nms
2 Replies

2. Shell Programming and Scripting

Psql output into array and read 2 fields into different variables

Hello Just edited the entry to make it easier to understand what i want How can i achieve this: GOAL: read 2 field from a table with PSQL result of this PSQL command is this INSTALLEDLANG=$(su - postgres -c "psql -A -t -q -c -d ${DBNAME} -t -c 'SELECT code, iso_code from res_lang'") ... (0 Replies)
Discussion started by: winston6071
0 Replies

3. Shell Programming and Scripting

Get the return value and get the output to $results

cmd() { echo " " echo "$(whoami)@$(hostname):$(pwd)# $*" results=`eval $*` echo $results } I want to get the eval $* 's return value and pass it to a new variable $val, and get "eval $*" 's the ... (7 Replies)
Discussion started by: yanglei_fage
7 Replies

4. Shell Programming and Scripting

Return output from shell script

Hi All, There are 2 scripts A and B. A --> It will invoke script B B --> It will generate below output. 100 - connected 105 - Not Connected 210 - Connected I want to return this value to script A. Please advice. (4 Replies)
Discussion started by: Girish19
4 Replies

5. Shell Programming and Scripting

Better to Use Return Code or wc -l Output?

Hey All, Quick question... I'm writing a short script to check if a continuous port is running on a server. I'm using "ps -ef | grep -v grep | grep processName" and I was wondering if it was better/more reliable to just check the return code from the command or if its better to pipe to... (12 Replies)
Discussion started by: mrm5102
12 Replies

6. Programming

Psql replace blanks with character

Well as the title describes, its a pretty straight forward problem. I have a series of psql tables where there are lots of blanks. However there is at least one column, called name, that will never be blank. I want to write a select statement to get all of the contents of the table and then turn... (3 Replies)
Discussion started by: wxornot
3 Replies

7. Windows & DOS: Issues & Discussions

how to return cygwin output to DOS

Hi, I have installed cygwin on my windows XP system. And I am trying to use the following code snippet: set SERVER="grep JDBCConnectionPool config.xml | gawk -F; '{print $2}'" sed -i 's/%SERVER%/WLMDEVDB1/' config.xml But it doesn't work because at runtime %SERVER% gets replaced by "grep... (2 Replies)
Discussion started by: illcar
2 Replies

8. Shell Programming and Scripting

Howto return the single penultimate line from my output

Hi All I have what seems to be something quite trivial but for the life of me can't work out a solution. Basically, I have the following script that reads a version report that contains certain flags. If a condition is true, I want to print the value of column 2, sort them uniquely and return... (2 Replies)
Discussion started by: kingpin2502
2 Replies

9. UNIX and Linux Applications

strange behavior of PSQL user defined function

Segregated the problematic portion, and showing for your view here., 1. Following is the function definition, create or replace function new_del(id integer) returns void as $$ begin raise info 'dollar :%',$1; delete from testing where id=$1; end ; $$ language 'plpgsql'; ... (1 Reply)
Discussion started by: thegeek
1 Replies

10. Shell Programming and Scripting

How to access psql from perl script?

Hi All, How to access the postgreSQL from a perl script? Thanks in advance JS (2 Replies)
Discussion started by: jisha
2 Replies
Login or Register to Ask a Question
CREATEUSER(1)						  PostgreSQL Client Applications					     CREATEUSER(1)

NAME
createuser - define a new PostgreSQL user account SYNOPSIS
createuser [ options... ] [ username ] DESCRIPTION
createuser creates a new PostgreSQL user. Only superusers (users with usesuper set in the pg_shadow table) can create new PostgreSQL users, so createuser must be invoked by someone who can connect as a PostgreSQL superuser. Being a superuser also implies the ability to bypass access permission checks within the database, so superuserdom should not be granted lightly. createuser is a shell script wrapper around the SQL command CREATE USER [create_user(7)] via the PostgreSQL interactive terminal psql(1). Thus, there is nothing special about creating users via this or other methods. This means that the psql application must be found by the script and that a database server must be running at the targeted host. Also, any default settings and environment variables used by psql and the libpq front-end library will apply. OPTIONS
createuser accepts the following command-line arguments: username Specifies the name of the PostgreSQL user to be created. This name must be unique among all PostgreSQL users. -a --adduser The new user is allowed to create other users. (Note: Actually, this makes the new user a superuser. The option is poorly named.) -A --no-adduser The new user is not allowed to create other users (i.e., the new user is a regular user, not a superuser). -d --createdb The new user is allowed to create databases. -D --no-createdb The new user is not allowed to create databases. -e --echo Echo the queries that createuser generates and sends to the server. -E --encrypted Encrypts the user's password stored in the database. If not specified, the default is used. -i uid --sysid uid Allows you to pick a non-default user ID for the new user. This is not necessary, but some people like it. -N --unencrypted Does not encrypt the user's password stored in the database. If not specified, the default is used. -P --pwprompt If given, createuser will issue a prompt for the password of the new user. This is not necessary if you do not plan on using pass- word authentication. -q --quiet Do not display a response. You will be prompted for a name and other missing information if it is not specified on the command line. createuser also accepts the following command-line arguments for connection parameters: -h host --host host Specifies the host name of the machine on which the server is running. If host begins with a slash, it is used as the directory for the Unix domain socket. -p port --port port Specifies the Internet TCP/IP port or local Unix domain socket file extension on which the server is listening for connections. -U username --username username User name to connect as (not the user name to create) -W --password Force password prompt (to connect to the server, not for the password of the new user). ENVIRONMENT
PGHOST PGPORT PGUSER Default connection parameters DIAGNOSTICS
CREATE USER All is well. createuser: creation of user "username" failed Something went wrong. The user was not created. If there is an error condition, the backend error message will be displayed. See CREATE USER [create_user(7)] and psql(1) for possibili- ties. EXAMPLES
To create a user joe on the default database server: $ createuser joe Is the new user allowed to create databases? (y/n) n Shall the new user be allowed to create more new users? (y/n) n CREATE USER To create the same user joe using the server on host eden, port 5000, avoiding the prompts and taking a look at the underlying query: $ createuser -p 5000 -h eden -D -A -e joe CREATE USER "joe" NOCREATEDB NOCREATEUSER CREATE USER SEE ALSO
dropuser(1), CREATE USER [create_user(7)] Application 2002-11-22 CREATEUSER(1)