This is a discussion on text output to mysql within the Shell scripting forums, part of the Development/Scripting category; Dear all, I wonder if someone can help me. On a linux server (RHEL) I collect different output file from ...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
|||
|
Dear all,
I wonder if someone can help me. On a linux server (RHEL) I collect different output file from different informations. these files I want to dump into a mysql db so I can create a php script that generate a reporting on the intranet. this should all happen automatically via crontab. Can someone help me please thanks a lot chebbab |
| Sponsored Links | ||
|
|
|
|||
|
Hi Monk,
Thanks for the reply. just little question, what about the output file containing alle the gathered data, in which format should it be. do I need to put all data with a seperator? greets chebbab |
|
|||
|
Hi my latest question I managed to find the solution
tail -1 file | cut -d= -f3 -f6 -f8 -f10 -f12 >> file.out touch file.tmp (for text in `cat file.out`; do echo -e -n " \b$text " >> file.tmp done cat file.tmp | tr [:blank:] , >> file.csv Now this works and I got all my needed data into a comma seperated file. I also tried the above received code from you Monk but I don't understand what it realy does, where does my .CSV file fits? these file need to be dumped into a mysql db in a table.. thanks for your help |
|
|||
|
Dear All,
In the meantime I'm using the above code to generate a file with all the necessary info I need and comma seperated. Now what I need is that a file is generated with the following conntent already insert into 'mytable' values (my comma seperated info generated from the previous script ;example insert into 'mytable' values (1,2,3,4); Who can help me out please |
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| To find and replace in text file | nashtech | Shell scripting | 3 | 07-31-2008 06:46 PM |
| need to convert text files into mysql database | zafar466 | Databases servers | 2 | 07-12-2008 12:31 PM |
| rearranging columns in a text file | sureshbup | Shell scripting | 2 | 12-06-2006 09:43 AM |
| Appending text files | sparky | Shell scripting | 13 | 04-03-2006 04:43 PM |
| Replacing text in a file using awk | postyrus | Shell scripting | 4 | 05-02-2005 03:31 PM |