title: Use "cut" in shell script without space as delimiter
body: <p>I'm trying to write a script that reads the file content below and extract the value in the 6th column of each line, then print each line without the 6th column. The comma is used as the delimiter.</p>
  
  <p>Input:</p>
  
  <pre><code>123,456,789,101,145,5671,hello world,goodbye for now
  223,456,789,101,145,5672,hello world,goodbye for now
  323,456,789,101,145,5673,hello world,goodbye for now
  </code></pre>
  
  <p>What I did was</p>
  
  <pre><code>#!/bin/bash
  for i in `cat test_input.txt`
  do
      COLUMN=`echo $i | cut -f6 -d','`
      echo $i | cut -f1-5,7- -d',' &gt;&gt; test_$COLUMN.txt
  done
  </code></pre>
  
  <p>The output I got was</p>
  
  <p>test_5671.txt:</p>
  
  <pre><code>123,456,789,101,145,hello
  </code></pre>
  
  <p>test_5672.txt:</p>
  
  <pre><code>223,456,789,101,145,hello
  </code></pre>
  
  <p>test_5673.txt:</p>
  
  <pre><code>323,456,789,101,145,hello
  </code></pre>
  
  <p>The rest of "world, goodbye for now" was not written into the output files, because it seems like the space between "hello" and "world" was used as a delimiter?</p>
  
  <p>How do I get the correct output</p>
  
  <pre><code>123,456,789,101,145,hello world,goodbye for now
  </code></pre>