trigger 写了:应该是gzbao9999 写了:echo $i|grep -Po ^.nishizawa23 写了:那请问`echo $i|rev|cut -c 1`的正则表达式咋写的?
echo "$i"|grep -Po .$

trigger 写了:应该是gzbao9999 写了:echo $i|grep -Po ^.nishizawa23 写了:那请问`echo $i|rev|cut -c 1`的正则表达式咋写的?
echo "$i"|grep -Po .$
代码: 全选
find . -name *.c -exec grep -Po '(?<=<)[^<>]*.h(?=>)' {} \;
代码: 全选
#!/bin/bash
#str=types.h;
str="linux/types.h";
#str=include/linux/types.h;
if [ `echo $str|grep '/'` ] ; then
head=`echo $str|grep -Po '^.*/(?=[^/]*.h)'`;
tail=`echo $str|grep -Po '(?<=/)[^/]*$'`;
find /usr/include/ -name $tail|grep $head;
else
find /usr/include/ -name $str;
fi;
代码: 全选
#!/bin/bash
find . -name *.c -exec grep -Po '(?<=<)[^<>]*.h(?=>)' {} \;> mytemp
while read str
do
echo $str=============;
if [ `echo $str|grep '/'` ] ; then
head=`echo $str|grep -Po '^.*/(?=[^/]*.h)'`;
# echo $head;
tail=`echo $str|grep -Po '(?<=/)[^/]*$'`;
# echo $tail;
find /usr/include/ -name $tail|grep $head;
else
find /usr/include/ -name $str;
fi;
done < mytemp
rm mytemp;
代码: 全选
#!/bin/bash
find . -name *.c -exec grep -Po '(?<=<)[^<>]*.h(?=>)' {} \;> mytemp
while read str
do
echo $str=============;
if [ `echo $str|grep '/'` ] ; then
tail=`echo $str|grep -Po '(?<=/)[^/]*$'`;
find /usr/include/ -name $tail|grep $str;
else
find /usr/include/ -name $str;
fi;
done < mytemp
rm mytemp;