awk 提取数字

echo b1c2d3d1e8f9 | awk '
{
     string=$0
     len=length(string)
     for(i=0; i<=len; i++) 
     {
          tmp=substr(string,i,1)
          if(tmp ~ /[1-9]/) 
          { 
              str=tmp
              str1=(str1 str)
         }
     }
     print str1
}'            

  命令行直接贴入以上代码。

猜你喜欢

转载自www.cnblogs.com/sea-stream/p/9665058.html
awk