查找总共10个字符 & z结尾的行。
[[email protected] ~]# grep "^.\{9\}z$" /usr/share/dict/words Abdul-Aziz Austerlitz chattererz chervonetz Rabinowitz razzmatazz roquellorz Rosenkranz tau-saghyz [[email protected] ~]#
查找a/b/c开头 & 21位是s的行
[[email protected] ~]# grep "^[a,b,c]...................s" /usr/share/dict/words all-comprehensiveness antienvironmentalists antiinstitutionalists bras-dessus-bras-dessous brigantinebrigantines chlamydobacteriaceous clothes-consciousness counterdemonstrations counterproductiveness [[email protected] ~]#
查找两位数字开头的行:
[[email protected] ~]# grep "^[0-9][0-9]" /usr/share/dict/words 1080 10-point 10th 11-point 12-point 16-point 18-point 20-point 30-30 48-point [[email protected] ~]#
查找a/b/c开头,不是a/b/c结尾的行:
[[email protected] ~]# grep "^[a,b,c][^a,b,c]$" /usr/share/dict/words a‘ a- a. a1 ad
查找a/b/c开头,大写字母结尾的行:
[[email protected] ~]# grep "^[a-c].*[A-Z]$" /usr/share/dict/words chloramine-T cS [[email protected] ~]#
时间: 2024-10-12 16:41:26