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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.