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
}'            

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

posted @ 2018-09-17 21:35  anobscureretreat  阅读(975)  评论(0编辑  收藏  举报