I'm trying to import a large csv file into Mysql. Unfortunately, the data within the file is separated both by spaces and tabs.
As a result, whenever I load the data into my table, I end up with countless empty cells (because Mysql only recognizes one field separator). Modifying the data before importing it is not an option, as I'm working with something like 400 million rows.
Here is an example of the data:
# 1574 1 1 1
$ 1587 6 6 2
$115 1878 8 9 23
(Where the second and third value of every row are separated by a tab)
Any ideas?
perl -i -pe 's/\s/|/g' your_file_name
for example would transform every space or tab in the file into a pipe|
character, which seems like a pretty straightforward solution, because then you'd have a single delimiter for MySQL to work with.