Changeset 8252


Ignore:
Timestamp:
2017-06-29T17:20:03+02:00 (3 months ago)
Author:
Nicolas MARTIN
Message:

#1724 Modify sed command for deleting key in order to match word (use \b)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2015/nemo_v3_6_STABLE/NEMOGCM/TOOLS/COMPILE/Fdel_keys.sh

    r8217 r8252  
    6060# 
    6161#- 
    62  echo "Removing keys in : ${NEW_CONF}" 
    63  for i in ${list_del_key} ; do 
    64         if [ "$(echo ${i} | grep -c key_nproc )" -ne 0 ] ; then 
    65                 sed -e "s/key_nproc[ij]=.* //"  ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm >  ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp 
    66                 mv ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp   ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm 
    67                 echo " " 
    68         elif [ "$(cat ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "$i" )" -ne 0 ] ; then 
    69                 sed -e "s/ ${i}[ ,$]/ /"  ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm >  ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp 
    70                 mv ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp   ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm 
    71                 echo "deleted key $i in ${NEW_CONF}" 
    72         fi 
    73  done 
    7462 
    75  unset -v list_del_key 
     63echo "Removing keys in : ${NEW_CONF}" 
     64 
     65for i in ${list_del_key} ; do 
     66 
     67     if [ "$(echo ${i} | grep -c key_nproc )" -ne 0 ]                                     ; then 
     68        sed -e "s/key_nproc[ij]=.* //" ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm \ 
     69            >  ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp 
     70        mv ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm 
     71        echo " " 
     72     elif [ "$(cat ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "$i" )" -ne 0 ]; then 
     73         sed -e "s/\b${i}\b//" ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm \ 
     74             >  ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp 
     75         mv ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm 
     76         echo "deleted key $i in ${NEW_CONF}" 
     77     fi 
     78 
     79done 
     80 
     81unset -v list_del_key 
Note: See TracChangeset for help on using the changeset viewer.