source:
NEMO/branches/2021/dev_r13747_HPC-11_mcastril_HPDAonline_DiagGPU/tests/DIA_GPU/internal_nl_workaround.pl
@
15309
Last change on this file since 15309 was 14846, checked in by mcastril, 3 years ago | |
---|---|
|
|
File size: 807 bytes |
Line | |
---|---|
1 | INUNITS=( numnam_ref numnam_cfg numnat_ref numnat_cfg numtrc_ref numtrc_cfg numnam_ice_ref numnam_ice_cfg numnamsed_ref numnamsed_cfg numnatp_cfg numnatp_ref ) |
2 | # |
3 | # build a list of files that need to be changed |
4 | # |
5 | listfile=tmplistfile$$.txt |
6 | for iunit in ${INUNITS[@]} |
7 | do |
8 | grep -l $iunit `find ./ -name '*.[fFh]90'` >> $listfile |
9 | done |
10 | allfiles=`cat $listfile | sort -u` |
11 | echo $allfiles |
12 | # |
13 | if [ -f $listfile ] ; then rm $listfile; fi |
14 | for f in $allfiles |
15 | do |
16 | echo "Working on " $f |
17 | n=0 |
18 | for n in `seq 0 1 $(( ${#INUNITS[*]} - 1 ))` |
19 | do |
20 | numnam=${INUNITS[$n]} |
21 | perl -ni -e 'unless ( m@.*\s*READ\s*\(\s*'${INUNITS[$n]}'\s*,\s*[a-z,0-9]*.*@) { print } else { $line= $_ ; $line=~s@(.*\s*READ\s*\()(\s*)('${INUNITS[$n]}')(\s*,\s*)([a-z0-9_]*)(.*)@\1\2\3(INDEX(\3,"\5 ")-1:)\4\5\6@i ; print $line }' $f |
22 | done |
23 | done |
Note: See TracBrowser
for help on using the repository browser.