Re: [Question:]How to split one file into 3/4 using fortran?

From: andy (andylcx_at_hotmail.com)
Date: 07/31/04


Date: 30 Jul 2004 16:00:11 -0700


"David Frank" <dave_frank@hotmail.com> wrote in message news:<fJLMc.2907$kU5.241019@twister.tampabay.rr.com>...
> "glen herrmannsfeldt" <gah@ugcs.caltech.edu> wrote in message
> news:v7AMc.23761$8_6.5504@attbi_s04...
> > andy wrote:
> >
> >> I have a question about how to split a file following into 3
> >> different files.
> >
> > Unless this is a homework assignment, I would do it in awk.
> >
> > -- glen
> >
> >
>
> Its simple in Fortran without having to learn such awkward <pun> syntax..
>
> Pls show us how awkward (clumsy) your fav language (PL/I) would be
> handling this problem..
>
> ! ---------------
> program split ! split.txt -> split.1, split.2, etc.
> implicit none
> integer :: n = 0
> character :: prev = ' '
> character(80) :: line
> character(10) :: filename = 'split.xxx'
>
> open (1,file='split.txt') ! input file
>
> do
> read (1,'(a)',end=101) line
> if (line(1:1) == '#'.and.prev /= '#') then
> n = n+1 ; write (filename(7:),'(i0)') n ! next filename
> close (2) ; open (2,file=filename)
> end if
> write (2,'(a)') trim(line) ! output line
> prev = line(1:1) ! track line contents
> end do
> 101 stop
> end program

Hi, a simple question! What does "/= '#'" meaning in the sentence "if
(line(1:1) == '#'.and.prev /= '#') then". I guess this is a fortran 90
feature. I only learned the fortran 77 and am not familiar with for90.
And I did not find any explanation in the book <Fortran 90
programming>.
Thanks



Relevant Pages

  • Re: Fortran or C
    ... good for string handling, like TCL. ... -|So that would "limit" me to fortran as you say. ... -|> Penn State Information Technology Services ... Penn State Information Technology Services ...
    (comp.lang.fortran)
  • Re: IMPLICIT NONE (F2k8+/-)
    ... And the victims range from the most novice to the most expert (who despite using IMPLICIT NONE in his own code often has to debug other, lesser, code.) ... It has to do with pragmatism, after 33 years of Fortran experience. ... by shrinking the market by nannying other programmers with whom you simply disagree. ... The compilers will always do so no matter what the standard says. ...
    (comp.lang.fortran)
  • Re: Fortran templates
    ... end type MYDATA ... Implicit statements have to come quite early ... Then this module is USEd in the module that defines the template ... in an analogous fashion in Fortran, ...
    (comp.lang.fortran)
  • Handling large datasets in Fortran
    ... I am sorry if my question is naiive, but I am having real difficulties ... in getting around the problem of handling very long arrays in Fortran ... I have read that Fortran has exceptional abilities in the ... handling of large datasets over other languages, which is good for me, ...
    (comp.lang.fortran)
  • Re: Help! reformat the data file
    ... I thought mine was obvious enough that even a Fortran programmer ... (awk tends to be more C like than other ... Except if you exit from a BEGIN action, ... and it is a waste to generate all the separate fields if they aren't ...
    (comp.lang.fortran)