当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 9 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : 这个是神码意思?grep '^[:alpha:]'
帖子发表于 : 2012-08-28 18:12 
头像

注册: 2012-05-31 12:00
帖子: 322
送出感谢: 14
接收感谢: 0 次
grep '^[:alpha:]'


页首
 用户资料  
 
2 楼 
 文章标题 : Re: 这个是神码意思?grep '^[:alpha:]'
帖子发表于 : 2012-08-28 18:38 
头像

注册: 2007-08-05 17:40
帖子: 4980
送出感谢: 0 次
接收感谢: 6
字幕开头


_________________
free VPN
YouKuDownLoader
代码:
pip3 install ykdl

install YouKuDownLoader, have fun in downloading.
YouKuDownLoader所支持网站列表


页首
 用户资料  
 
3 楼 
 文章标题 : Re: 这个是神码意思?grep '^[:alpha:]'
帖子发表于 : 2012-08-28 22:51 
头像

注册: 2012-05-31 12:00
帖子: 322
送出感谢: 14
接收感谢: 0 次
cnkilior 写道:
字幕开头

alpha表示字母吗?还是:alpha:表示字母? :em20


页首
 用户资料  
 
4 楼 
 文章标题 : Re: 这个是神码意思?grep '^[:alpha:]'
帖子发表于 : 2012-08-28 23:12 

注册: 2008-10-31 22:12
帖子: 6546
系统: 践兔
送出感谢: 18
接收感谢: 25
[[:alpha:]]表示字母。


_________________
代码:
] ls -ld //


页首
 用户资料  
 
5 楼 
 文章标题 : Re: 这个是神码意思?grep '^[:alpha:]'
帖子发表于 : 2012-08-28 23:13 

注册: 2008-10-31 22:12
帖子: 6546
系统: 践兔
送出感谢: 18
接收感谢: 25
以下摘录自grep(1),版权由manpage指定。
代码:
   Character Classes and Bracket Expressions
       A bracket expression is a list of characters  enclosed  by  [  and  ].   It
       matches  any  single  character in that list; if the first character of the
       list is the caret ^ then it matches any character not  in  the  list.   For
       example, the regular expression [0123456789] matches any single digit.

       Within  a bracket expression, a range expression consists of two characters
       separated by a hyphen.  It matches any single character that sorts  between
       the  two  characters,  inclusive, using the locale's collating sequence and
       character set.  For example, in the default C locale, [a-d]  is  equivalent
       to  [abcd].  Many locales sort characters in dictionary order, and in these
       locales [a-d] is typically not equivalent to [abcd]; it might be equivalent
       to  [aBbCcDd],  for  example.   To obtain the traditional interpretation of
       bracket expressions, you can  use  the  C  locale  by  setting  the  LC_ALL
       environment variable to the value C.

       Finally,  certain named classes of characters are predefined within bracket
       expressions, as follows.  Their names are self explanatory,  and  they  are
       [:alnum:],   [:alpha:],   [:cntrl:],   [:digit:],   [:graph:],   [:lower:],
       [:print:], [:punct:], [:space:], [:upper:], and [:xdigit:].   For  example,
       [[:alnum:]] means the character class of numbers and letters in the current
       locale. In the C locale and ASCII character set encoding, this is the  same
       as  [0-9A-Za-z].   (Note that the brackets in these class names are part of
       the symbolic names, and must  be  included  in  addition  to  the  brackets
       delimiting  the  bracket  expression.)   Most  meta-characters  lose  their
       special meaning inside bracket expressions.  To include a literal  ]  place
       it  first in the list.  Similarly, to include a literal ^ place it anywhere
       but first.  Finally, to include a literal - place it last.


_________________
代码:
] ls -ld //


页首
 用户资料  
 
6 楼 
 文章标题 : Re: 这个是神码意思?grep '^[:alpha:]'
帖子发表于 : 2012-08-28 23:15 

注册: 2008-10-31 22:12
帖子: 6546
系统: 践兔
送出感谢: 18
接收感谢: 25
代码:
● /bin/grep '^[:alpha:]' <<< 'ls'
/bin/grep: 字符类的语法是 [[:space:]],而非 [:space:]


_________________
代码:
] ls -ld //


页首
 用户资料  
 
7 楼 
 文章标题 : Re: 这个是神码意思?grep '^[:alpha:]'
帖子发表于 : 2012-08-28 23:38 
头像

注册: 2009-04-11 23:46
帖子: 4130
系统: Arch Linux
送出感谢: 11
接收感谢: 124
[:alpha:] 就是其中那几个字符的或……POSIX 风格的字符类是放在字符类 [] 中的 [:name:],不用两层 [] 会有二义性。


_________________
我的博客 https://blog.lilydjwg.me/
提问的智慧
Arch Linux 中文论坛

我的vimrc: https://git.io/vimrc


页首
 用户资料  
 
8 楼 
 文章标题 : Re: 这个是神码意思?grep '^[:alpha:]'
帖子发表于 : 2012-08-29 18:06 
头像

注册: 2012-05-31 12:00
帖子: 322
送出感谢: 14
接收感谢: 0 次
tusooa 写道:
以下摘录自grep(1),版权由manpage指定。
代码:
   Character Classes and Bracket Expressions
       A bracket expression is a list of characters  enclosed  by  [  and  ].   It
       matches  any  single  character in that list; if the first character of the
       list is the caret ^ then it matches any character not  in  the  list.   For
       example, the regular expression [0123456789] matches any single digit.

       Within  a bracket expression, a range expression consists of two characters
       separated by a hyphen.  It matches any single character that sorts  between
       the  two  characters,  inclusive, using the locale's collating sequence and
       character set.  For example, in the default C locale, [a-d]  is  equivalent
       to  [abcd].  Many locales sort characters in dictionary order, and in these
       locales [a-d] is typically not equivalent to [abcd]; it might be equivalent
       to  [aBbCcDd],  for  example.   To obtain the traditional interpretation of
       bracket expressions, you can  use  the  C  locale  by  setting  the  LC_ALL
       environment variable to the value C.

       Finally,  certain named classes of characters are predefined within bracket
       expressions, as follows.  Their names are self explanatory,  and  they  are
       [:alnum:],   [:alpha:],   [:cntrl:],   [:digit:],   [:graph:],   [:lower:],
       [:print:], [:punct:], [:space:], [:upper:], and [:xdigit:].   For  example,
       [[:alnum:]] means the character class of numbers and letters in the current
       locale. In the C locale and ASCII character set encoding, this is the  same
       as  [0-9A-Za-z].   (Note that the brackets in these class names are part of
       the symbolic names, and must  be  included  in  addition  to  the  brackets
       delimiting  the  bracket  expression.)   Most  meta-characters  lose  their
       special meaning inside bracket expressions.  To include a literal  ]  place
       it  first in the list.  Similarly, to include a literal ^ place it anywhere
       but first.  Finally, to include a literal - place it last.

试了下 [:alnum:], [:alpha:],好像都可以的样子


页首
 用户资料  
 
9 楼 
 文章标题 : Re: 这个是神码意思?grep '^[:alpha:]'
帖子发表于 : 2012-08-30 14:51 

注册: 2008-10-31 22:12
帖子: 6546
系统: 践兔
送出感谢: 18
接收感谢: 25
13378333 写道:
tusooa 写道:
以下摘录自grep(1),版权由manpage指定。
代码:
   Character Classes and Bracket Expressions
       A bracket expression is a list of characters  enclosed  by  [  and  ].   It
       matches  any  single  character in that list; if the first character of the
       list is the caret ^ then it matches any character not  in  the  list.   For
       example, the regular expression [0123456789] matches any single digit.

       Within  a bracket expression, a range expression consists of two characters
       separated by a hyphen.  It matches any single character that sorts  between
       the  two  characters,  inclusive, using the locale's collating sequence and
       character set.  For example, in the default C locale, [a-d]  is  equivalent
       to  [abcd].  Many locales sort characters in dictionary order, and in these
       locales [a-d] is typically not equivalent to [abcd]; it might be equivalent
       to  [aBbCcDd],  for  example.   To obtain the traditional interpretation of
       bracket expressions, you can  use  the  C  locale  by  setting  the  LC_ALL
       environment variable to the value C.

       Finally,  certain named classes of characters are predefined within bracket
       expressions, as follows.  Their names are self explanatory,  and  they  are
       [:alnum:],   [:alpha:],   [:cntrl:],   [:digit:],   [:graph:],   [:lower:],
       [:print:], [:punct:], [:space:], [:upper:], and [:xdigit:].   For  example,
       [[:alnum:]] means the character class of numbers and letters in the current
       locale. In the C locale and ASCII character set encoding, this is the  same
       as  [0-9A-Za-z].   (Note that the brackets in these class names are part of
       the symbolic names, and must  be  included  in  addition  to  the  brackets
       delimiting  the  bracket  expression.)   Most  meta-characters  lose  their
       special meaning inside bracket expressions.  To include a literal  ]  place
       it  first in the list.  Similarly, to include a literal ^ place it anywhere
       but first.  Finally, to include a literal - place it last.

试了下 [:alnum:], [:alpha:],好像都可以的样子

是[[]]


_________________
代码:
] ls -ld //


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 9 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 0 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译