Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I split a delimited file without /n?
    primarykey
    data
    text
    <p>I have this data :</p> <pre><code>920-1063-03@0001D92E@2012-07-02 920-1063-04@00002F5F@2012-07-02 920-1063-04@00002453@2012-07-02 920-1063-03@0001D256@2012-07-02 920-1063-03@0001E225@2012-07-02 920-1063-03@0001E3C1@2012-07-02 920-1063-04@00001EA6@2012-07-02 920-1063-03@0001D316@2012-07-02 920-1063-04@00002A41@2012-07-02 920-1063-04@00001ADA@2012-07-02 920-1063-04@00002DFD@2012-07-02 920-1063-03@0001C595@2012-07-02 920-1063-04@00001C24@2012-07-02 920-1063-04@00002341@2012-07-02 920-1063-04@00001645@2012-07-02 920-1063-04@00001C04@2012-07-02 </code></pre> <p>Which I am trying to split delimited by the <code>@</code> sign.</p> <p>To do this I have this code:</p> <pre><code>&lt;?php $filename = "tru_cage_DSB_sn"; $fd = fopen ($filename, "r"); $contents = fread ($fd,filesize ($filename)); fclose ($fd); $delimiter = "@"; $splitcontents = explode($delimiter, $contents); $counter = ""; foreach ( $splitcontents as $color ){ $counter = $counter+1; echo "&lt;b&gt;Split $counter: &lt;/b&gt; $color&lt;br&gt;"; } ?&gt; </code></pre> <p>The output will be like this :</p> <pre><code>Split 1: 920-1063-03 Split 2: 0001D92E Split 3: 2012-07-02 920-1063-04 Split 4: 00002F5F Split 5: 2012-07-02 920-1063-04 </code></pre> <p>However, I would like the split to also separate <code>2012-07-02 920-1063-04</code> into two strings, delimited by space. So the output should be like this?</p> <pre><code>Split 1: 920-1063-03 Split 2: 0001D92E Split 3: 2012-07-02 Split 4: 920-1063-04 Split 5: 00002F5F Split 6: 2012-07-02 Split 7: 920-1063-04 </code></pre> <p>How do I split this further?</p> <p>Or, is there a way to directly insert these data to a mySQL database with 3 columns?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload