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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-25-2017, 08:48 AM
|
#1
|
LQ Newbie
Registered: Apr 2017
Posts: 3
Rep:
|
Script for insert a lot of files in oracle database.
Hello everybody,
I have a directory with a lot of log files, i want to insert the logs (*.log and *.trt.log) in database. log files are like this:
11/04/2017 12:00:02 11959 trt_ret_tp START Chargement des fichiers HREREC (trt_ret_tp)
11/04/2017 12:00:02 11959 trt_ret_tp Aucun fichier ▒ traiter
11/04/2017 12:00:02 11959 trt_ret_tp Mise a jour de la date de dernier recouvrement
11/04/2017 12:02:42 11959 trt_ret_tp STOP Chargement des fichiers HREREC (trt_ret_tp)
I need a script that select specific files (.log and .trt_.log) and insert them into a table!!!
Any suggestion!!!
thanks for your help...
|
|
|
04-25-2017, 08:55 AM
|
#2
|
LQ Guru
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
|
Hi shirin,
Welcome to LQ.
You question is kind of wide open. Oracle has a plethora of tools to import data into a table. Do you want to put the entire log file in a field, have that field be the entire record, and the table to be single column?
|
|
1 members found this post helpful.
|
04-26-2017, 02:59 AM
|
#3
|
LQ Newbie
Registered: Apr 2017
Posts: 3
Original Poster
Rep:
|
hi AwesomeMachine,
thanks for your reply, i want a table with 5 column, (date_time,num_process,shell,event,comment), and i want insert a lot of file with same structure one after another in the table, something like this(example with two file, but i have more than 1000 file like this):
date_time num_process shell event comment
11/04/2017 12:00:02 11959 trt_ret_tp START Chargement des fichiers HREREC (trt_ret_tp)
11/04/2017 12:00:02 11959 trt_ret_tp Aucun fichier ▒ traiter
11/04/2017 12:00:02 11959 trt_ret_tp Mise a jour de la date de dernier recouvrement
11/04/2017 12:02:42 11959 trt_ret_tp STOP Chargement des fichiers HREREC (trt_ret_tp)
12/05/2017 12:00:02 11959 trt_ret_tp START Chargement des fichiers HREREC (trt_ret_tp)
12/05/2017 12:00:02 11959 trt_ret_tp Aucun fichier ▒ traiter
12/05/2017 12:00:02 11959 trt_ret_tp Mise a jour de la date de dernier recouvrement
12/05/2017 12:02:42 11959 trt_ret_tp STOP Chargement des fichiers HREREC (trt_ret_tp)
did i answer your question?
|
|
|
04-26-2017, 03:00 AM
|
#4
|
LQ Newbie
Registered: Apr 2017
Posts: 3
Original Poster
Rep:
|
Quote:
Originally Posted by AwesomeMachine
Hi shirin,
Welcome to LQ.
You question is kind of wide open. Oracle has a plethora of tools to import data into a table. Do you want to put the entire log file in a field, have that field be the entire record, and the table to be single column?
|
hi AwesomeMachine,
thanks for your reply, i want a table with 5 column, (date_time,num_process,shell,event,comment), and i want insert a lot of file with same structure one after another in the table, something like this(example with two file, but i have more than 1000 file like this):
date_time num_process shell event comment
11/04/2017 12:00:02 11959 trt_ret_tp START Chargement des fichiers HREREC (trt_ret_tp)
11/04/2017 12:00:02 11959 trt_ret_tp Aucun fichier ▒ traiter
11/04/2017 12:00:02 11959 trt_ret_tp Mise a jour de la date de dernier recouvrement
11/04/2017 12:02:42 11959 trt_ret_tp STOP Chargement des fichiers HREREC (trt_ret_tp)
12/05/2017 12:00:02 11959 trt_ret_tp START Chargement des fichiers HREREC (trt_ret_tp)
12/05/2017 12:00:02 11959 trt_ret_tp Aucun fichier ▒ traiter
12/05/2017 12:00:02 11959 trt_ret_tp Mise a jour de la date de dernier recouvrement
12/05/2017 12:02:42 11959 trt_ret_tp STOP Chargement des fichiers HREREC (trt_ret_tp)
did i answer your question?
|
|
|
04-26-2017, 07:28 AM
|
#5
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,915
|
Quote:
Originally Posted by shirin1900
Hello everybody,
I need a script that select specific files (.log and .trt_.log) and insert them into a table!!!
Any suggestion!!!
|
Hi shirin and welcome to LQ.
Please review the Site FAQ for information related to how to ask an effective question as well as how to prepare the information for your question.
Please note a few things here: - You've stated your problem, updated it with additional information, and you've asked for someone to write code for you in the form of a script
- Members at LQ are volunteers, thus they are not paid support.
- The LQ site is intended to help you to learn, with the additional, and reasonable point that, it is better to have you be educated on the tools and talents necessary to complete your project. And thus your capabilities are enhanced, and perhaps in the future you can offer some of your expertise to other members in need of assistance. This is a main point of the LQ site.
- Therefore what to do here is to indicate what language of script you wished to code this within, and at least attempt your first script, of any nature. Other members need to know what script language you prefer, and also should get an understanding approximately what level of knowledge you have with that script language.
- Another part of this is to devise and post your steps to solve your problem. Citing examples and stating what you wish the outcome to be is a good starting idea, however it is best to look at general data which you can expect and write a full description of what you intend to accomplish, citing all possible input criteria, and then listing all possible outcomes you expect from that. From there you can write pseudocode which is a plain language description of the script actions you intend to fulfill.
- From this point you can script very effectively, and it does go back to the earlier information where you need to pick a script language and show some effort towards your goal.
- I'm quite sure that if you follow these guidelines and illustrate a very clear, organized description of your problem and what you feel the solution should be, as well as your attempts at a script, that LQ members will have very many suggestions to aid you with completing your project.
Best Regards
|
|
|
All times are GMT -5. The time now is 07:44 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|