I have updated some of my projects with such commands:
$ find . -iname *.f90 -exec sed -i 's/use iso_c_binding/use, intrinsic :: iso_c_binding/' '{}' \;
Here, find
will recursively search all the .f90
files in a project and apply the following sed
command to replace the string use iso_c_binding
by use, intrinsic :: iso_c_binding
. The option -i
means --in-place
: the file is modified instead of begin written on the standard output. And '{}'
will be replaced by the path of each Fortran file.
We have assumed that all was written in lowercase, but you can also use the \|
operator (an escaped |) to search variants. The parenthesis around each expression are also escaped:
$ find . -iname *.f90 -exec sed -i 's/\(use iso_fortran_env\)\|\(use ISO_FORTRAN_ENV\)/use, intrinsic :: iso_fortran_env/' '{}' \;
I have tested on some projects.
Of course, you should first make a test on a copy of your project, as all files will me modified without asking confirmation.
Note: there is three other intrinsic modules, the IEEE modules.