Re: removing blanks from a file



Blanks (or any desired char) can be removed from a file record with 1
statement.
! ---------------
program test
character :: line*80, a(80), pad(80)=' ' ; equivalence (a,line)

open (1,file='old.txt') ! create test file
write (1,*) ' 1, 11, 111, 1111'
write (1,*) ' 2, 22,222, 2222'
rewind (1)
open (2,file='new.txt')

do
read (1,'(a)',end=101) line ; a = pack(a,a/=' ',pad)
write (2,*) trim(line)
end do
101 stop
end program


.