样本
/opt/abc/efg_hello_211/world/world
/opt/abc/efg-hello-2112/world/world
方法一.cat test.txt |grep "server"|awk -F'/' '{print $4}'|grep -o '[0-9]\{3,\}'
方法二.cat test.txt |grep "server"|awk -F'/' '{print $4}'|awk -F '-|_' '{print $3}'
原文链接:https://www.f2er.com/bash/390189.html