title: Skipping input lines with @, # and &
body: <p>I have a data file where some of the lines start with @, # and &amp;. The file also contains the numerical data column. I want only the numerical data column.</p>
  
  <p>So how to write a Fortran program to get fresh data avoiding the line starting with special characters?</p>
  
  <p>I tried with the code provided in the post. But it is reading only first line of the numerical data not the remaining the lines.</p>
  
  <pre><code>@ target g0.s1         
  @ type xysize
  0.05966 -70.06945   0.07000
  0.08949 -70.06946   0.07000
  0.11932 -70.06946   0.07000
  0.14915 -70.06946   0.07000
  0.17898 -70.06946   0.07000
  @ autoscale onread none
  @ target g0.s2         `
  </code></pre>
  
  <p>the code</p>
  
  <pre><code>implicit none
  
  integer, parameter :: iu = 10
  
  real               :: x
  
  integer            :: ierr
  
  open (unit=iu,file="data.txt",action="read")
  
  do
  
     read (iu,*,iostat=ierr) x
  
     if (ierr == 0) exit
  
  end do
  
  print*,"x =",x
  
  end program xread_data
  </code></pre>