title: Reading from a CSV file and writing to a new CSV file using openCSV in java
body: <p>I'm writing a program which reads a CSV file and I modify some columns.After modifying I have to write it to a new CSV file with modifications.</p>
  
  <p>I have done till reading and modifying but when I'm writing it to a new file I'm just getting a single row.I'm struck here.</p>
  
  <p>Help me overcome this?</p>
  
  <p>I'm using openCSV and language is Java.</p>
  
  <p>My code:</p>
  
  <pre><code>CSVReader reader;
  try 
  {   
    File file=new File("/home/srinivas/Desktop/saicharan/Cardsmod.csv");
    if(file.createNewFile()){ }
    reader = new CSVReader(new FileReader(filename));
    String filewrite="/home/srinivas/Desktop/saicharan/Cardsmod.csv";   
    CSVWriter writer=new CSVWriter(new FileWriter(filewrite));
    String[] row;
    while((row = reader.readNext()) != null)
    {
      String str=new String();
      String str1=new String();
      for(int i=0;i&lt;row.length;i++)
      {
        str1=str1+","+row[i];
        if(row[i].equals("Card Text Listen"))
        {
          String [] nextLine = reader.readNext();
          String [] nextLine1=reader.readNext();
          str=str+nextLine[i]+nextLine1[i];           
          c2.met(str);
        }
        if(i==11)
        {
          String[] rowwrite=str1.split(",");
          writer.writeNext(rowwrite);                     
        }
      }
    }
    writer.close();
  }
  </code></pre>
  
  <p>Thank You.</p>