Thread: Command line output - How to output values only?

Command line output - How to output values only?

From
"sdger erger"
Date:
When I retrieve SQL queries through the command line I get outputs like:

Code:

Title
-------
value
(1 row)


Is there anything I can do, any option I can choose, to retrieve only the value?

Code

value

Re: Command line output - How to output values only?

From
Andreas Kretschmer
Date:
sdger erger <killen.nextdoor@gmail.com> schrieb:

> Is there anything I can do, any option I can choose, to retrieve only the
> value?
>
>                                      CCooddee
>
>                                      value


You can use \t to toggle to show rows only.


Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."    (unknow)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

Re: Command line output - How to output values only?

From
Charley Tiggs
Date:
If you mean while using psql with the -c switch, add -t.

psql -t dbname username -c "select * from foo" > data_file.txt

If you mean from within the client environment, use \t.

Charley

sdger erger wrote:
> When I retrieve SQL queries through the command line I get outputs like:
>
>  *Code:*
> Title
> -------
> value
> (1 row)
>
>
> Is there anything I can do, any option I can choose, to retrieve only the
> value?
>
>  *Code*
> value
>