Batch Copy files and Replace content accordingly
生活随笔
收集整理的這篇文章主要介紹了
Batch Copy files and Replace content accordingly
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
2019獨角獸企業(yè)重金招聘Python工程師標準>>>
#!/bin/bash # Read all file names into an array FilesArray=($(find . -name "deriv1-clrn*qa.jil")) # Get length of an array FilesIndex=${#FilesArray[@]} # Use for loop read all directory names for (( i=0; i<${FilesIndex}; i++ )); do source="${FilesArray[$i]}" destination="$(echo "${source}" | sed 's/qa/prod/')" echo "cp ${source} ${destination}" if [ -f ${destination} ]; then rm ${destination} fi touch "${destination}" awk -v destination="$destination" '{a = ($0); b = gensub("qa","prod","g",a); print b >> destination; }' "${source}" done #awk '{print $0}' $destination
轉載于:https://my.oschina.net/u/939893/blog/194712
總結
以上是生活随笔為你收集整理的Batch Copy files and Replace content accordingly的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 模拟面试感受之一
- 下一篇: To the Greatness of