[MITgcm-devel] Re: bang syntax and extended source

Ed Hill ed at eh3.com
Thu Jun 10 18:12:25 EDT 2004


On Thu, 2004-06-10 at 17:59, Andrea Molod wrote:
> hi ed,
> 
> thanks for the info on the random number generator.
> 
> i have 4 files in which i would like to get rid of the
> bang syntax and the extended source. inserting a carraige
> return and changing the ! to a C (to make it a comment)
> would be great for the bang stuff. for the extended source,
> is there a way just to spit out a list of line numbers, say,
> where the source goes beyond 72 columns? then i can go in
> there easier by hand and make the continuation where it should
> be. the files are on my directory on authors:
> ~molod/fizhi/lwrad.f
>              swrad.f
>              moist.f
>              turb.f
> there is other syntax in there that i need to get rid of too,
> like some :: stuff, but i will deal with that later. (as well
> as making them .F files instead of .f)
> if you prefer just to write a shell script that i can run, that
> would be great too.


Hi Andrea,

One quick way to find Fortran line numbers greater than 72 characters is
(in bash):

  for i in *.[fF] ; do
    echo $i
    cat $i | gawk '(substr($0,0,1)==" " && length($0)>72){print NR}'
  done

or for just the files you want:

  cd ~molod/fizhi
  for i in  lwrad.f swrad.f moist.f turb.f ; do
    echo $i
    cat $i | gawk '(substr($0,0,1)==" " && length($0)>72){print NR}'
  done

Ed

-- 
Edward H. Hill III, PhD
office:  MIT Dept. of EAPS;  Rm 54-1424;  77 Massachusetts Ave.
             Cambridge, MA 02139-4307
emails:  eh3 at mit.edu                ed at eh3.com
URLs:    http://web.mit.edu/eh3/    http://eh3.com/
phone:   617-253-0098
fax:     617-253-4464
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://mitgcm.org/pipermail/mitgcm-devel/attachments/20040610/0ff73307/attachment.sig>


More information about the MITgcm-devel mailing list