shell循环取两个关键字中间的文字并输出

#!/bin/bash
test1=""
for test in $(cat morningglory.2023-03-03.0.log |grep have | sed -r 's/.*have(.*)role.*/\1/'| sed s/[[:space:]]//g)
do
test1="$test"','"$test1"
done
echo "$test1" >1.txt

posted @ 2023-03-03 16:11  HarsonLee  阅读(185)  评论(0编辑  收藏  举报