d******e 发帖数: 143 | 1 请教个SED的用法
我有一些LOG文件,每一行的格式是一样的
我要把第5个field作一下运算再附在一起,如下
turn lines like this:
E,1204905442,3006,238,83888208,126586,N,0059221,T,K
into:
E,1204905442,3006,238,83888208[2128],126586,N,0059221,T,K
我感觉应该用这些shell,sed之类的应该挺容易的,可是写出来发现要用sed两次,很郁闷
不知道如何对匹配的部分直接运算一下
for s in $(cat $1)
do
errcode=$(echo $s | sed 's/E,[0-9]*,[0-9]*,[0-9]*,\([0-9]*\),.*/\1/')
errcode=$(($errcode % 65536))
echo $s | sed 's/\(E,[0-9]*,[0-9]*,[0-9]*,\)\([0-9]*\)\(,.*\)/\1\2['$errcode
']\3/'
done
多谢 |
|
st 发帖数: 1685 | 2 plz help:
line.Format("{call %s.dbo.p_getVDKFilters (%d, %s, null, ?, ?)}",
m_sDatabase, m_instance, from_date);
the call is like
{call p_getVDKFilters (-1,null,null,@errcode,@errmsg)}
I can get output result from query analyzer, the similar
java program works... but this one does...
very simliar call to another store procedure can work...
the problem is one of the "null" is a datetime type for output parameter.
the other store procedure has nothing like this...
it outputed once, after a minor c |
|