shell如何截取字符串中的数字

12345zynet 234game 7903checaht如何将其后面的字母去掉,输出:12345 234 7903
已邀请:

Ansible - 项目实施 系统工程师

赞同来自: koyo

# cat aa.txt
12345zynet
234game
7903checaht1、替换法
# sed 's///g' aa.txt
12345
234
79032、过滤匹配法
# grep -Eo '+' aa.txt
12345
234
7903

push - 打杂的!

# awk -F'+' 'NF=NF' file# grep -oP '\d+' file

要回复问题请先登录注册