• Post Reply Bookmark Topic Watch Topic
  • New Topic

Replace tabs with commas

 
suneetha uppu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have 42,000 text files which are separated by tab. I want to convert all these text files automatically to 42,000 csv files. Can anyone please help me in this regard?

Thanks & Regards
Suneetha
 
Piet Souris
Rancher
Posts: 1625
35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, that should be a straightforward job.

First, put the names of all these 42.000 files in a List,
then for each file in the List, open that file
and for alle lines in that file, replace every TAB by a comma
and write that line back to a new file, probably same name but with extension 'csv'.
And by using as many threads as you have processors, you might get some speed improvement
as well (not guaranteed, though).

But tsv files are as readable as csv files, so is there any specific reason for this task?

Greetz,
Piet
 
suneetha uppu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Piet,

Thank you for your response. Actually, my simulated data files are .txt files which has 20 attributes and 800 samples separated by tab. I want to convert all these .txt files to .arff or .csv files such that I can run in weka tool. After I convert .tx files to csv/.arff files I want to run all these 42,000 csv files automatically in weka tool to classify the data.

Thank you
Regards
Suneetha
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!