program main
integer ln
real newval,oldval
ln=178
open(unit=10,file='file.txt',
& status='old',form='FORMATTED',access='sequential')
rewind 10
do n=1,ln-1,1
if(n.eq.ln)then
read(10,20)oldval
endif
enddo
write(*,*)'Old value was'
write(*,20)oldval
do n=1,ln-1,1
if(n.eq.ln)then
write(10,20),newval
endif
enddo
write(*,*)'New value is'
write(*,20)newval
20 format(10x,f10.3)
close(10)
end program
in the above program I would like to modify the columns 11-20 in line
178 of "file.txt". Text file contains lines of different lengths,
character strings, floating point numbers etc.
It seems that I am unable to locate ****perly the columns and/or the
line.
Any help will be much appreciated.
regards
MI


|