title: Parsing Log file in Python and saving it to csv
body: <p>I have a log file which is around 1.5 GB.
  The file contains log data in the following format:</p>
  
  <pre><code>A|B|C|D delimited by '|' character and does not have column names. It has only 
  four columns
  </code></pre>
  
  <p>How can I parse it to python 3.6 and then export it to .csv  file and add user defined column names.
  How delimit the number of rows while exporting to .csv file.</p>
  
  <p>I have started writing the code as below but do not know how to proceed further:</p>
  
  <pre><code>import re
  import pandas as pd
  from pandas import ExcelWriter
  
  infile = r"D:\Sys\file.log"
  
  df = pd.DataFrame()
  with open(infile,encoding="ISO-8859-1") as f:
     f = f.readlines()
  
  for line in f:
     print(line)
  </code></pre>
  
  <p>I am able to get the lines as I checked it with print statement.</p>