通过do while一行一行地进行编辑
通过do while一行一行地进行编辑
如何在while循环中编辑文件的一行,代码除了在“if”语句内部的部分以外都有效,有人之前做过吗?(今天的第二个问题,谢谢)\n
#!/bin/bash export ELMS_STORAGE="/loc1/f1.csv" export CUSTOMER_LIST="/loc2/f2.csv" while read -r ELMS_SIZE ELMS_NAME ELMS_ENV do while IFS=, read -r CUSTOMER_ENV CUSTOMER_URI CUSTOMER_NAME CUSTOMER_SCHEMA_OWNER CUSTOMER_DB_INSTANCE OTHER do if [ "${ELMS_NAME}" = "${CUSTOMER_URI}" ]; then #### 向f2.csv添加一个新项 ${ELMS_STORAGE}.${ELMS_ENV}="${ELMS_ENV} ${CUSTOMER_URI}" ### 不起作用 fi done < <(tac $CUSTOMER_LIST) done < <(tac $ELMS_STORAGE) exit
\n编辑前的f2.csv\n
monkey dog tiger
\n编辑后的f2.csv\n
monkey brown bird green cat yellow