title: How to reorder a CSV file to group by contents of a particular column
body: <p>I am very new go Golang and my question is not cleared also,  but this is what I am trying to achieve.
  I have a csv file as follow, as I am mainly trying to re-arrange/sort last column(status=passed,failed/skipped)</p>
  <pre><code>test,test-cat,skipped
  test,test-cat,failed
  test,test-cat,passed
  test,test-cat,skipped
  test,test-cat,passed
  test,test-cat,failed
  </code></pre>
  <p>Expecting <strong>last column</strong> to be grouped them together if it has same status.</p>
  <pre><code>test,test-cat,skipped
  test,test-cat,skipped
  test,test-cat,failed
  test,test-cat,failed
  test,test-cat,passed
  test,test-cat,passed
  </code></pre>
  <p>With this codes I did, it does not look good:-) but it works as I wanted.</p>
  <pre class="lang-golang prettyprint-override"><code>package main
  import (
          &quot;bufio&quot;
          &quot;fmt&quot;
          &quot;os&quot;
          &quot;strings&quot;
  )
  func main() {
          var FailStat, SkipStat,PassStat []string
        
          file, err := os.Open(&quot;test.csv&quot;)
  
          if err != nil {
                  fmt.Println(err)
          } else {
                  scanner := bufio.NewScanner(file)
                  for scanner.Scan() {
                          line := scanner.Text()
                          if strings.Contains(line, &quot;failed&quot;) {
                                  FailStat = append(FailStat, line)
  
                          }
                          if strings.Contains(line, &quot;skipped&quot;) {
                                  SkipStat = append(SkipStat, line)
  
                          }
                          if strings.Contains(line, &quot;passed&quot;) {
                                  PassStat = append(PassStat, line)
  
                          }                       
                  }
          }
          file.Close()
  
          var finalstat []string
          finalstat = append(SkipStat, FailStat...)
          finalstat = append(finalstat, PassStat...)
  
          for _, line := range finalstat {
             fmt.Println(line)
     }
  }
  </code></pre>
  <p><strong>Test-Run:</strong></p>
  <pre class="lang-bash prettyprint-override"><code>$ ./readfile 
  test,test-cat,skipped
  test,test-cat,skipped
  test,test-cat,failed
  test,test-cat,failed
  test,test-cat,passed
  test,test-cat,passed
  </code></pre>
  <p>There must be a many better ways, please advice. Sorry for newbie question!</p>