!program to read 2 columns and write 4 columns program read2_write4 use precision_def use sim_utils implicit none real(rp) two(2), four(4) integer lun, lun1 integer reason character*100 word logical first/.true./ lun= lunget() open(unit=lun, file='KickerPulse_Run3b_Run4_Normalized.dat') lun1=lunget() open(unit=lun1, file='KickerPulse_Run3b_Run4_4col_Normalized.dat') do while(.true.) read(lun,'(a100)',IOSTAT=reason)word if(reason <0) exit if(index(word,'#')/=0)then write(lun1,'(a)')word else if(first)then write(lun1,'(a1,4a12)')'#','time [ns]','kicker1','kicker2','kicker3' first=.false. endif read(word,*)two(1), two(2) write(lun1,'(4es12.4)')two(1),two(2),two(2),two(2) endif end do print *,'reason=',reason print *,'write kicker_pulse_run3b4_4col.dat' end program