title: How to parse log file to csv file in Java
body: <p>I want read my log file and put into csv file via Java. How would I parse the log file with these delimiters into csv file as below.</p>
  <p>.log file:</p>
  <pre><code>2022-06-01 11:00:00 wt.nm=aa&amp;wt.ti=t1&amp;
  2022-06-02 12:00:00 wt.nm=ab&amp;wt.ti=t2&amp;
  2022-06-03 10:00:00 wt.nm=ac&amp;wt.ti=t3&amp;
  </code></pre>
  <p>date and time is separated by space, name and title separated by wt.nm=/wt.ti with &amp; as end</p>
  <p>CSV output:</p>
  <pre><code>date,time,name,title 
  2022-06-01,11:00:00,aa,t1
  2022-06-02,12:00:00,ab,t2
  2022-06-03,10:00:00,ac,t3
  </code></pre>
  <pre><code>import java.io.*;
  public class test {
      public static void main(String[] args) {
          try{
              BufferedReader in = new BufferedReader(new FileReader(&quot;/Users/ts/Desktop/test/src/0606.log&quot;));
              FileWriter wb = new FileWriter(&quot;/Users/ts/Desktop/testcsv.csv&quot;);
              String str;
              while((str=in.readLine()) != null) {
                  System.out.println(str);
                  wb.write(str);
              }
          }
          catch (IOException e) {
          }
      }
  }
  </code></pre>