can any one explain which is the best way to store the data from a text file into the sqlite3 data base using bash?

i have text file tried to read that file and stored in an array and tried to store in database not working properly..can any one explain how can i achieve this.

thanks
vishnu kalakotaAsked:
Who is Participating?
 
Gerwin Jansen, EE MVETopic Advisor Commented:
Parse required field from your text file with awk (use field separator), set fields to variables and create insert statements, in a loop.
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
Can you post the script you have sofar? And what error you are getting?
0
 
gheistCommented:
sqlite cli is more suiteable for your purpose.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
gheistCommented:
I'd try blindly to use .import from sqlite3 CLI
0
 
gelonidaCommented:
could you show as an example text file.
Everything depends on the format of your text file.

Depending on it's format sqlite-cli + bash might be sufficient and best

If not I would strongly suggest to write the import script not as a bash script, but in something like python, perl
The code will be easier to write / read / maintain and both suggested languages are installed on most *nix machines
0
 
MikeOM_DBACommented:
All database(s) provide a means to bulk-load data, either through a utility or a sql command (Like LOAD..INTO).
Now in sqllite3 you may need to generate and use INSERT statements as stated above by Gerwin.
Now regardless of the database, you could use an open-source ETL tool like CloverETL or Pentaho.
0
 
vishnu kalakotaAuthor Commented:
I've requested that this question be deleted for the following reason:

i have got the better sollution for this question
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
You cannot close the question this way. You've been given a few good suggestions on how to solve this. You should choose and award points.
0
 
gheistCommented:
You should outline your solution, using BASH preferably, as stated in initial question...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.