Author Topic: CSV-tab converter  (Read 210 times)

Mark Barkey

  • Administrator
  • Jr. Member
  • *****
  • Posts: 72
    • View Profile
CSV-tab converter
« on: November 08, 2016, 11:18:15 PM »

Mark Barkey

  • Administrator
  • Jr. Member
  • *****
  • Posts: 72
    • View Profile
Re: CSV-tab converter
« Reply #1 on: November 08, 2016, 11:19:05 PM »
Code: [Select]
       Program csvtab


c
c      M. E. Barkey
c      23 October 2016
c      This program converts comma to tab delimitted.
c
c





       Real a, b, olda
      Character*8  lc1
      Character*11 lc2
      Character*13 lc3
      Integer i, j, nofiles, fl, newl
      Character*80 filename, fullname
      character*90 outfile
      character*90 prefix

   

     
      open (16, file = 'numfiles.dat')
      read(16,*) nofiles
      close(16)
     
     
      open (15, file = 'filelist.dat')
     
      do 500 j = 1, nofiles
     
      read (15,*) filename
     
      outfile = trim(filename) // '.xls'
     
     
      fullname = trim(filename)
     
      fl = len(fullname)
     
      newl = fl -4
      prefix = trim(fullname(1:newl))
      outfile = trim(prefix) // '.xls'
     
     
      write (*,*) 'Processing: ', prefix, outfile
       
     
     
     
 
     
     
     
     
     
   
      open (12, file = outfile)


       open (14, file = filename, status = 'old')

       
       
       
       
       
        read (14, *) lc1, lc2, lc3
C        write (*,*) lc1, lc2, lc3
       
        do 100 i = 1, 1000000
       
        read (14, *) a, b
C        write(*,*) a,b
       

       
       
       
        if (olda.eq.a) then
        go to 300
        end if
   
        write (12,*) a, char(9), b
        olda = a
       
       
       
 100 continue       
       
 300    continue       
       
close(12)
close (14)

 500    continue
 
 
stop

 900   format (a8, a11, a13)

       End