Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Not able to write SQL query output in to .csv file with shell script. Post 303036121 by sandeepgoli53 on Friday 14th of June 2019 10:51:38 AM
Old 06-14-2019
Hi RudiC,

Yes i changes column names and used '|' as delimiter.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need help in reading a output of a sql query in unix script

i'm used a sql query in a unix script to get the information from table. but unable to extract the output which i need. Any help with logic will be greatly appreciated. my sql query provide output some thing like this - col1 col2 count ---- ---- ------ A B 10 c D 6 e... (8 Replies)
Discussion started by: pharos467
8 Replies

2. Shell Programming and Scripting

TO execute .sql 2005 query file in shell script

Hi, I know in oracle a .sql file is called by @ <path> /<filename>. But how to call in sql 2005, I am opening the sql sessionwith sqsh, is there any command to execute there a .sql file (query in sql 2005) in K shell script. (0 Replies)
Discussion started by: n2ekhil
0 Replies

3. Shell Programming and Scripting

How to use sql data file in unix csv file as input to an sql query from shell

Hi , I used the below script to get the sql data into csv file using unix scripting. I m getting the output into an output file but the output file is not displayed in a separe columns . #!/bin/ksh export FILE_PATH=/maav/home/xyz/abc/ rm $FILE_PATH/sample.csv sqlplus -s... (2 Replies)
Discussion started by: Nareshp
2 Replies

4. Shell Programming and Scripting

SQL Script's output to a CSV file

I need to call and execute an SQL script within a KSH script and get the output/extracted data into a CSV file. Is there any way to get the out put in a CSV file other than spooling ? I tried spooling. Problem is if there is any wrning/comment/Error they all will be spooled into the csv file. I... (4 Replies)
Discussion started by: Sriranga
4 Replies

5. Shell Programming and Scripting

Problem in formatting output of SQL query in excel sheet in shell script

Hi Guys.. Need your help to format the output of my shell script. I am using spool command to take out put in csv file. below is my code. (for example) col USERNAME for a15 col EMAIL for a30 col FULL_NAME for a20 col LAST_LOGIN for a40 col DATE_CREATED for a40 SPOOL 120.csv... (3 Replies)
Discussion started by: Agupte
3 Replies

6. Shell Programming and Scripting

SQL query in UNIX script - output in flat file

Hi, I never did this before... what I want to do is execute a SQL query from a unix script and redirect sql query's output to a flat file (comma separated one) without the header info (no column names). I would also want not to print the query's output to the screen. snapshot of my script:... (13 Replies)
Discussion started by: juzz4fun
13 Replies

7. Shell Programming and Scripting

SQL Query in Shell Script output formatting

Hi All, #!/bin/ksh call_sql () { sql=$1 sqlplus -s $sqlparam_sieb <<EOF SET ECHO OFF; SET NEWPAGE NONE; SET SQLBL OFF; SET VERIFY OFF; SET LINESIZE 2000; SET... (2 Replies)
Discussion started by: Kevin Tivoli
2 Replies

8. Shell Programming and Scripting

Need to write shell script for my .sql file call

Hi Guys, I need to write a simple shell script which will generate a .csv file/report by calling .sql file inside a shell script. Can somebody help me on this. Thanks in advance! Regards, LK (7 Replies)
Discussion started by: lakshmanraok117
7 Replies

9. Shell Programming and Scripting

Run sql query in shell script and output data save as delimited text

I want to run sql query in shell script and output data save as delimited text (delimited text would be comma) Code: SPOOL_FILE=/pgedw/dan.txt SQL=/pgedw/dan.sql sqlplus -s username/password@myhost:port/servicename <<EOF set head on set COLSEP , set linesize 32767 SET TRIMSPOOL ON SET... (8 Replies)
Discussion started by: Jaganjag
8 Replies

10. Shell Programming and Scripting

Shell script appending output of sql query

I am writing the following script to create the file v_out.txt. sqlplus -s /nolog << EOF CONNECT scott/tiger@orcl; whenever sqlerror exit sql.sqlcode; set newpage 0; SET PAGESIZE 0; SET ECHO OFF; SET FEEDBACK OFF; SET HEADING OFF; SET VERIFY OFF; SET LINESIZE 100; set tab off; set... (7 Replies)
Discussion started by: itzkashi
7 Replies
PMIE2COL(1)						      General Commands Manual						       PMIE2COL(1)

NAME
pmie2col - convert pmie output to multi-column format SYNOPSIS
pmie2col [-d delimiter] [-p precision] [-w width] DESCRIPTION
pmie2col is a simple tool that converts output from pmie(1) into regular column format. Each column is 7 characters wide (by default, may be changed with the -w option) with a single space between columns. That single space can be substituted with an alternate delimiter using the -d option (this is useful for importing the data into a spreadsheet, for example). The precision of the tabulated values from pmie can be specified with the -p option (default is 2 decimal places). This option can and will override any width setting in order to present the requested precision. The pmie(1) configuration must follow these rules: (1) Each pmie(1) expression is of the form ``NAME = expr;''. NAME will be used as the column heading, and must contain no white space, although special characters can be escaped by enclosing NAME in single quotes. (2) The ``expr'' must be a valid pmie(1) expression that produces a singular value. In addition, pmie(1) must be run with the -v command line option. It is also possible to use the -e command line to pmie(1) and output lines will be prefixed by a timestamp. EXAMPLE
Given this pmie(1) configuration file (config): loadav = kernel.all.load #'1 minute'; '%usr' = kernel.all.cpu.user; '%sys' = kernel.all.cpu.sys; '%wio' = kernel.all.cpu.wait.total; '%idle' = kernel.all.cpu.idle; 'max-iops' = max_inst(disk.dev.total); Then this command pipeline: $ pmie -v -t 5 <config | pmie2col -w 8 Produces output like this: loadav %usr %sys %wio %idle max-iops 0.21 ? ? ? ? ? 0.36 0.49 0.03 0.18 0.29 25.40 0.49 0.41 0.10 0.36 0.13 51.00 0.69 0.49 0.10 0.05 0.37 43.20 0.71 0.39 0.08 0.04 0.49 14.00 0.83 0.63 0.15 0.00 0.21 32.30 1.09 0.60 0.02 0.10 0.27 47.00 0.92 0.01 0.00 0.00 0.99 2.40 PCP ENVIRONMENT
Environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. On each installation, the file /etc/pcp.conf contains the local values for these variables. The $PCP_CONF variable may be used to specify an alternative configura- tion file, as described in pcp.conf(5). SEE ALSO
PCPIntro(1) and pmie(1). Performance Co-Pilot PCP PMIE2COL(1)
All times are GMT -4. The time now is 05:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy