LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-01-2004, 03:24 PM   #16
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910

Quote:
i think u dont understand
No, you don't understand.

To assess what tool to use we need to know
whether the text in your sql file is a query
or the result of a query.

E.g. query:
"select name from user where clueless = true"


Result of query:
unixfreak
j.vilon
---------
2 rows found



Cheers,
Tink
 
Old 11-02-2004, 08:28 AM   #17
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,569

Rep: Reputation: 171Reputation: 171
acid, Tinkster I think you're approaching the problem from the wrong direction.

j.vilon, CSV is a spreadshet format. When read properly (but you need to specify the right separator!) in a spreadsheet program (like Excel) you'll get all fields right (rows and columns). Then you can save the file in any format you wish, for example as xls.
 
Old 11-02-2004, 11:35 AM   #18
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Mara,

I think you're approaching the problem from the wrong
direction ... the only files I've ever seen with an extension
of SQL were actual queries, or sequences of SQL commands
to restore a database.

Acid and I are trying to find out what it actually is, and
telling him about CSV is all good and well, and if it was
the stripped down result of a query I'd agree with you
wholeheartedly on the possibility on just renaming the
thing from SQL to CSV, and reading it from excel.

But we can't be sure that it is.



Cheers,
Tink
 
Old 11-03-2004, 01:25 PM   #19
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,569

Rep: Reputation: 171Reputation: 171
Well, such conversion only makes sense when the file is with inserts. Then CSV will work just well (using right separation...).
 
Old 11-04-2004, 05:15 AM   #20
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 61
Transforming the output (result) of an SQL query should be not too hard with an awk script.
More over, know that Excel also reads HTML. If you create a simple HTML4 file with extension .XLS, Excel reads it OK.
Typical good-looking excel file is:
Code:
<html><head><title>a title</title></head><body><table>
<tr>
  <th>Header 1</th><th>Header 2</th>
</tr>
<tr>
  <td>data 1</td><td>data 2</td>
</tr>
</table></body></html>
And so on... you can add more data. You can give colors, fonts..., but AFAIK, no CSS.

Yves.
 
Old 11-04-2004, 01:08 PM   #21
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Actually the csv approach would be easier for
a result-set :) ... just stripping out the - and | separators
from fixed positions and removing the bottom row,
and renaming it to csv, voila.


Cheers,
Tink
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
database or xls doc? mifan Programming 6 09-05-2005 05:22 PM
xml to xls matt1982 Programming 5 12-16-2004 12:47 PM
Opening xls Excel Docs on Linux ddrfreak Mandriva 2 12-14-2004 12:09 AM
.doc, .xls & .jpg became 0kb paeng16 General 1 07-30-2004 09:21 AM
export .xls into a mysql table anyone? h/w Programming 1 03-17-2004 11:36 AM


All times are GMT -5. The time now is 06:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration