例如截取日志信息中的json类型的输入信息:
脚本如下:
#!/bin/sh
IFS=""
testfile=$1
while read -r line
do
echo $line
test1=${line##*\'签名验证错误\'}
test1=${test1%currentid*}
echo $test1
##res_code=`echo $test1 | python -c \'import sys, json; print(json.load(sys.stdin)[\'order_complete_time\'])\'`
##echo $res_code
##exit
##temp= echo $line | cut -d "\"" -f 19
##if [ -n "$temp" ]; then
## echo $temp
##fi
done < $testfile