Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6741711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:45:29+00:00 2026-05-26T11:45:29+00:00

I have a bunch of Fortran 77 files that use a non-standard structure notation

  • 0

I have a bunch of Fortran 77 files that use a non-standard structure notation (described here):

STRUCTURE /item/
   INTEGER id
   CHARACTER(LEN=200) description
   REAL price
END STRUCTURE

This is apparently a syntax that was used by some old compilers but was later standardized in Fortran 90 to the following:

TYPE item
   INTEGER id
   CHARACTER(LEN=200) description
   REAL price
END TYPE

What I want to do is use sed or some other appropriate tool to automatically process my source files to locate all uses of the old syntax and patch them to use the updated syntax (i.e. change all instances of “structure” to “type” and remove the slashes). I’m sure that I can build up some set of regular expressions to do this, but I’m not skilled enough in that art to get started.

On a side note, there is a similar incompatibility with record notation, also described in the link:

RECORD /item/ pear, store_catalog(100)

becomes:

TYPE(item) pear, store_catalog(100)

I assume similar techniques can be used to fix those instances also.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:45:30+00:00Added an answer on May 26, 2026 at 11:45 am

    I’m not very familiar with Fortran syntax so I don’t know how to generalize this, but your example can be tackled with

    sed 's%^STRUCTURE /\(.*\)/$%TYPE \1%;
         s%^END STRUCTURE$%END TYPE%'
    

    Note the use of % to separate the command (s, substitute), pattern and replacement. Normally you would use /, but that’s part of the pattern to be matched.

    Your RECORD problem should indeed have a similar solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bunch of html files that come with my app and are
Suppose you have got a bunch of files written in C, C++ or Fortran,
I have bunch of objects that return a DOM-tree that I then use to
I have a bunch of buttons that all use the same .click() method. How
I have bunch of EPS vector files that I want to convert to Xaml
I have bunch of gems on my computer that I want to use in
I have bunch of php files in directory structure say /mylibs I want to
I have a bunch of files in a folder checked out from a repository.
I have a bunch of code in a routine that looks a bit like
I have a bunch of strings that are dependent on static dictionaries and each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.