#1.get seeven_test
--------------------------
grep ^attributeTypes= ctbkUat3.schema | grep "X-ORIGIN 'user defined'" >>ctbkUat3.schema.udf
grep ^attributeTypes= ctbkUat3.schema | grep "X-ORIGIN ( ' ' 'user defined' )" >>ctbkUat3.schema.udf
grep ^objectClasses= ctbkUat3.schema | grep "X-ORIGIN 'user defined'" >>ctbkUat3.schema.udf
##下面这句可能找出正确的
grep ^objectClasses= ctbkUat3.schema | grep "X-ORIGIN ( ' ' 'user defined' )" >>ctbkUat3.schema.udf
cat ctbkUat3.schema.udf|sed 's/^attributeTypes=/attributetype /'|sed 's/^objectClasses=/objectclass /'|sed -r "/'email'|'top'/s/^/#/" >seeven_test
#2.Roll way and mind
对文件4操作
截取数据:以"s=( "开头,以" NAME"结束
按分隔符截取:echo hello, world | cut -f 2 -d " "则输出"world"(截取以空格分割的第二部分)
cat ctbkUat3.schema.udf|sed 's/^attributeTypes=/attributetype /'|sed 's/^objectClasses=/objectclass /'|sed -r "/'email'|'top'/s/^/#/" >seeven_test
grep -E "USAGE directoryOperation|NO-USER-MODIFICATION" $2 | cut -f4 --delimiter=' '|tr -d "'"|sed 's/^/^/' >sun_reserved_attr
grep -E "USAGE directoryOperation|NO-USER-MODIFICATION" ctbkUat3.schema | cut -f4 --delimiter=' '|tr -d "'"|sed 's/^/^/'
cat $1|{
while read aLine; do
########不论大小写将sun_reserved_attr非空的部分
echo $aLine|grep -i -f sun_reserved_attr >/dev/null 2>&1
isFound=`echo $?`
if test $isFound -eq 0; then
echo "#$aLine" >>$3
else
echo $aLine >>$3
fi
done
}
--要替换的部分
grep -E " /(|NAME " seeven_test| cut -f3 --delimiter=' '
#调用函数
#randomlist 20
#第二部分 处理问题文件
cat seeven_test|{
while read eachLine; do
#判断指定部分是否数字和"."的组和
if grep -E " /(|NAME " $eachLine| cut -f3 --delimiter=' '#未完成
printf ""
else
randomlist 20
grep -E " /(|NAME " $eachLine| cut -f3 --delimiter=' '|sed -e 's/^*/'
fi
done
}
----------------------
3.the way from Danny
the command that can help test the correctness of oid: grep -E ^/([0-9]+[/.]+/)+[0-9]+$