需要从如下格式中用shell脚本提取符合条件的行,终于搞定,自我庆贺一下
text [ decimal] text: message
最终的脚本实现如下
#!/bin/bash
function help() {
cat <<EOF
Usage: Invoke ". pick.bmsg.sh match-string bmsg-output-file" from your shell to pick matched messages to ouput stdout:
- match-string: key-string to match
- bmsg-output-file: a filename created by bmsg processing logcat and dmesg
EOF
echo ""
}
vfilename=""
vmatchtmp=""
if [ -f $1 ]; then
vfilename=$1
vmatchtmp=$2
else
if [ -f $2 ]; then
vfilename=$2
vmatchtmp=$1
else
help
exit 0;
fi
fi
if test x"$vmatchtmp" = x; then
help
exit 0;