title: Split JSON into multiple files
body: <p>I have json file exported from mongodb which looks like:</p>
  
  <pre><code>{"_id":"99919","city":"THORNE BAY"}
  {"_id":"99921","city":"CRAIG"}
  {"_id":"99922","city":"HYDABURG"}
  {"_id":"99923","city":"HYDER"}
  </code></pre>
  
  <p>there are about 30000 lines, I want to split each line into it's own <code>.json</code> file. <em>(I'm trying to transfer my data onto couchbase cluster)</em></p>
  
  <p>I tried doing this:</p>
  
  <pre><code>cat cities.json | jq -c -M '.' | \
  while read line; do echo $line &gt; .chunks/cities_$(date +%s%N).json; done
  </code></pre>
  
  <p>but I found that it seems to drop loads of line and the output of running this command only gave me 50 odd files when I was expecting 30000 odd!!</p>
  
  <p>Is there a logical way to make this not drop any data using anything that would suite?</p>