1. 在目录中查找名字中含有 "fvPatch" 的文件,使用find命令:
find $FOAM_SRC "*fvPatch"
2. 在某个文件中查找字符,使用grep命令
grep -r -n LES $FOAM_SOLVERS -r recursive -n line number
3. 在案例库中中查找使用边界条件“slip”的文件:
find $FOAM_TUTORIALS -type f | xargs grep -sl 'slip'
4. sed命令在脚本中的应用
while read -r scheme do
echo "Updating fvSchemes to use $scheme"
sed "s/DIVSCHEME/$scheme/g" fvSchemes.template >
fvSchemesdp"${scheme}" done < schemesToTest
schemesToTest是一个文件 每一行含有一个对流格式的名称。引用使用变量的方式$scheme