- 论坛徽章:
- 0
|
通用点的,不管用_分为几个域
[root@Mylinux 1]# cat file
b_zzz_jjj_dddd_xxxx_cs_iter_1.am
a_c_cs_iter_1.am
b_cs_iter_10.am
c_b_cs_iter_4.am
b_cs_iter_11.am
a_c_cs_iter_12.am
b_cs_iter_2.am
c_b_cs_iter_11.am
a_c_cs_iter_13.am
b_cs_iter_6.am
c_b_cs_iter_1.am
a_xxx_yyyc_cs_iter_5.am
[root@Mylinux 1]# awk -F '[_.]' '{print $(NF-1)"_"$0}' file|sort -t_ -k2,2 -k1,1n |awk '{sub(/^[^_]*_/,"")}1'
a_c_cs_iter_1.am
a_xxx_yyyc_cs_iter_5.am
a_c_cs_iter_12.am
a_c_cs_iter_13.am
b_zzz_jjj_dddd_xxxx_cs_iter_1.am
b_cs_iter_2.am
b_cs_iter_6.am
b_cs_iter_10.am
b_cs_iter_11.am
c_b_cs_iter_1.am
c_b_cs_iter_4.am
c_b_cs_iter_11.am
[ 本帖最后由 ywlscpl 于 2009-4-23 20:00 编辑 ] |
|