title: Reading file line by line using awk and for loop
body: <p>File contains compiler generated warnings</p>
  
  <p>warnings.txt(with 8 lines)</p>
  
  <pre><code> Line1  "/Project/user/XYZ/gsoap/gsoap-2.8.9/gsoap/stdsoap2.cpp", line 1657: error #4296-D: arithmetic operation on boolean type
   Line2{ return soap-&gt;count - soap-&gt;buflen + soap-&gt;bufidx - (soap-&gt;ahead != 0);
   Line3
   Line4  
   Line5  "/Project/user/XYZ/gsoap/gsoap-2.8.9/gsoap/stdsoap2.cpp", line 4136: warning #3348-D: declaration hides variable "err" (declared at line 3
   Line6 700)
   Line7          { int err = SSL_get_error(soap-&gt;ssl, r);
   Line8                ^  
  </code></pre>
  
  <p>I want to read this file line by line using awk as while loop takes much time to process</p>
  
  <p>Two ways i tried:</p>
  
  <pre><code>for line in `awk '{print $0}' warnings.txt`
  do
    echo $line
  done
  </code></pre>
  
  <p>and,</p>
  
  <pre><code>for line in `awk '{BEGIN{ORS="\n";}{print $0}' warnings.txt`
  do
    echo $line
  done
  </code></pre>
  
  <p><strong>Expected Output:</strong></p>
  
  <p>Same as above(i.e. content of file line by line)</p>
  
  <pre><code> Line1  "/Project/user/XYZ/gsoap/gsoap-2.8.9/gsoap/stdsoap2.cpp", line 1657: error #4296-D: arithmetic operation on boolean type
   Line2{ return soap-&gt;count - soap-&gt;buflen + soap-&gt;bufidx - (soap-&gt;ahead != 0);
   Line3
   Line4  
   Line5  "/Project/user/XYZ/gsoap/gsoap-2.8.9/gsoap/stdsoap2.cpp", line 4136: warning #3348-D: declaration hides variable "err" (declared at line 3
   Line6 700)
   Line7          { int err = SSL_get_error(soap-&gt;ssl, r);
   Line8                ^  
  </code></pre>
  
  <p><strong>My output:</strong></p>
  
  <pre><code>"/Project/user/XYZ/gsoap/gsoap-2.8.9/gsoap/stdsoap2.cpp",
  line
  1657:
  error
  #4296-D:
  arithmetic
  operation
  on
  boolean
  type
  {
  return
  soap-&gt;count
  -
  soap-&gt;buflen
  +
  soap-&gt;bufidx
  -
  (soap-&gt;ahead
  !=
  0);
  "/Project/user/XYZ/gsoap/gsoap-2.8.9/gsoap/stdsoap2.cpp",
  line
  4136:
  warning
  #3348-D:
  declaration
  hides
  variable
  "err"
  (declared
  at
  line
  3
  700)
  {
  int
  err
  =
  SSL_get_error(soap-&gt;ssl,
  r);
  ^
  </code></pre>
  
  <p>Thanks        </p>