我有文件名,所以我只想选择一个没有( - )
6.6.482.R2
6.6.482.R2-KAob.ios
6.6.482.R2-Kaw.ios
6.6.482.R2-Ksware.ios
6.6.482.R2-KCyb.ios
6.6.482.R2-software.blm
6.7.142.R1
6.7.142.R1-KAob.ios
6.7.142.R1-Kaw.ios
6.7.142.R1-Ksware.ios
6.7.142.R1-KCyb.ios
6.7.142.R1-software.blm
我只想提取这两行
6.6.482.R2
6.7.142.R1
此致
答案 0 :(得分:0)
如果我正确理解了问题,您只需要前缀。我假设您的图片以
结尾"-something"
lsort -unique [regexp -all -inline -- {alm-[^ -]*} $data]
答案 1 :(得分:0)
% set x {
alm-6.6.482.R2
alm-6.6.482.R2-KAob.ios
alm-6.6.482.R2-Kaw.ios
alm-6.6.482.R2-Ksware.ios
alm-6.6.482.R2-KCyb.ios
alm-6.6.482.R2-software.blm
alm-6.7.142.R1
alm-6.7.142.R1-KAob.ios
alm-6.7.142.R1-Kaw.ios
alm-6.7.142.R1-Ksware.ios
alm-6.7.142.R1-KCyb.ios
alm-6.7.142.R1-software.blm
}
alm-6.6.482.R2
alm-6.6.482.R2-KAob.ios
alm-6.6.482.R2-Kaw.ios
alm-6.6.482.R2-Ksware.ios
alm-6.6.482.R2-KCyb.ios
alm-6.6.482.R2-software.blm
alm-6.7.142.R1
alm-6.7.142.R1-KAob.ios
alm-6.7.142.R1-Kaw.ios
alm-6.7.142.R1-Ksware.ios
alm-6.7.142.R1-KCyb.ios
alm-6.7.142.R1-software.blm
% lsort -unique [regsub -all -line {alm-([^ -]+).*} $x {\1}]
6.6.482.R2 6.7.142.R1
%