Jump to content

Textfile convert to csv or database


bluespace

Recommended Posts

Hi guys,  I have a huge text file which i would like to convert to csv or mysql database directly, can this be made possible, solutions of any would be much appreciated, or pointers to what all should I learn/do, the ideas if this can be made possible :) thanks for all the help

 

--> rules.txt


Rule Name: hello
Input Text: hi
Input Text: hello
Output Text: Hi, nice to meet you 
Output Text: welcome 

Rule Name: howru
Input Text: how are you ?
Input Text: how r u ?
Output Text: I am fine  
Output Text: Fine, what about you ?


 

I like to get something like this after processing all values separated with a semicolon

 

hello; hi; hello; Hi, nice to meet you :); Hi, nice to meet you :)

 

with loops for each block

 

or taking Rule Name:, Input Text: & Output Text: values to a mysql database directly with a loop which will add records from the text block, so that in  a database or a csv becomes like

 

ID  Rule Name        Input Text                            Output Text  (becomes)

1    hello                hi; hello                            hello; Hi, nice to meet you :)

2    howru      how are you ?; how r u ?        I am fine; Fine, what about you ?

 

 

 

 

 

 

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/207916-textfile-convert-to-csv-or-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.