How to retrive data from DB(Aqua studio) in CVS format using UNIX script?
I am using aqua studio DB. I need to retrive the data from my database using uxin script in .csv format. i am using select query along with the joins. my o/p in the DB is of the below format.
The first queston in csv solutions is "Does the data include char with comma or double quotes?"
If not, it never needs quoting or escapes.
In csv, embedded commas must be double-quoted and embedded double quotes must be doubled! For example, if a column contained ' We said "Hello, sailor!" ', then it needs to be ' "We said ""Hello, sailor!"" ' or even ' We said ""Hello"," sailor!"" ' (double quotes right around the comma)! Many double quote every column against commas, but most forget double quote doubling! In a C/C++/JAVA/PERL program, you can detect comma and only quote on need, whole column in case it has multiple commas, for a minimum file size. CSV is very compressible, too.
You can select into excel with odbc and save as csv!
You can select with any command line tool (isql from unixODBC, jisql for xigole w/JDBC) and use sed or awk to reformat it trimmed with comma separators.
If the tool has a column separator, you can set it to comma, or convert it to comma.
You can put the commas in your select: select col_a || ',' || col_b .... Sometimes the concatenated string exceeds the allowed length unless you break it up.
You can put a marker on the data lines so they are simple to detect and separate from headings, error reports and status:
We could process in bash if you insist.
Last edited by DGPickett; 03-13-2013 at 05:31 PM..
Hi ,
i am generating some data by firing sql query with connecting to the database by my solaris box.
The below one should be the header line of my excel ,here its coming in separate row.
TO_CHAR(C. CURR_EMP_NO
---------- ---------------
LST_NM... (6 Replies)
Hi,
I have a file with data in the following format
BOX
-1.000000 -1.000000 0.000000
30.00000 14.00000 0.1000000
0.000000 0.000000 0.000000
0.000000
0.000000
CYLINDER
3.595000 2.995000 0.000000
0.5100000 2.000000
Z
0.000000 0.000000
0.000000
I want to convert these files... (1 Reply)
hi every one i want to read and write data from cvs file using c program. but my problem is that at run time my data is increasing in both row wise and column wise. that means it is continuously updating in both direction.
is there any way through which i can find the next colum or row for eg... (0 Replies)
Hi,
I am having couple of files which i used to copy from windows to Linux, so now in case of text files (CTRL^M) appears at end of line. I know i can convert this windows format file to unix format file by running dos2unix.
My requirement here is that i want to do it automatically using a... (5 Replies)
Hi all,
I need a script specially using loops to print below output...
variables x, a and b will be read from user...
x a b
x+1 a b+1
x+2 a b+2
x+3 a+1 b
x+4 a+1 b+1
x+5 a+1 b+2
for example....
1 ... (4 Replies)
Hi all,
I have written a shell script to search a specified directory (e.g. /home/user) for a list of specific words (shown as ${TMPDIR}/wordlist below). The script works well enough, but I was wondering if there was a way to display the line number that the word is found on?
Thanks!
cat... (1 Reply)
Hi There
I needed to write a Unix shell script which will pick up the data from a .CSV file and reformat it as per the requirement and write it to another .CSV file.
Currently I am in the proess of Data Import to "Remedy System" (A one kind of incident mangement Application) and this... (8 Replies)
hi
i have following file.
where i m trying to retrive data on latest date.
let us say we are extracting data from this file for Jun 30 where date is highest date in log file.
here i want to take output in other file from first line of Jun 30 to the end of file
in short i want retrive... (5 Replies)