<p>I need to import largish (24MB) text files into a MySQL table. Each line looks like this:</p>

<pre><code>1 1 0.008  0  0  0  0  0                                    
</code></pre>

<p>There are one or more spaces after each field, and the last field is tailed by about 36 spaces before the newline.</p>

<p>How do I import such a file into MySQL? From the documentation it seems that LOAD DATA expects all fields to be terminated by exactly the same string. I have tried</p>

<pre><code>LOAD DATA INFILE 'filename' INTO TABLE mytable FIELDS TERMINATED BY ' ';
</code></pre>

<p>but MySQL will interpret a sequence of more than one space as delimiting an empty field.</p>

<p>Any ideas?</p>

If you're on unix/linux then you can put it through sed.
open a terminal and type:
```
```
sed 's/ \+/ /g' thefile > thefile.new
```
```
this replaces all sequences of multiple spaces with one space.