title: How to sort multiple columns: CSV? c++
body: <p>I am attempting to sort a CSV file by specifying which column order to sort in: </p>
  
  <p>for example: ./csort 3, 1, 5 &lt; DATA > SORTED_DATA</p>
  
  <p>or ./csort 3, 4, 6, 2, 1, 5 &lt; DATA ...</p>
  
  <p>example line of DATA: 177,27,2,42,285,220</p>
  
  <p>I used a vector split(string str) function to store the columns specified in the arguments which require sorting. Creating a vector:</p>
  
  <pre><code>vector&lt;string&gt; columns {3, 1, 5}; // for example
  </code></pre>
  
  <p>Not entirely sure how to use this columns vector to proceed with the sorting process; though, I am aware that I could use sort.</p>
  
  <pre><code>sort(v.begin(), v.end(), myfunction);
  </code></pre>