[A-Z]表示[A-Za-z]的含义是什么? [英] What is up with [A-Z] meaning [A-Za-z]?

查看:575
本文介绍了[A-Z]表示[A-Za-z]的含义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经注意到一段时间了,在我至少使用的某些基于Unix的系统上,ls [A-Z]*一直在给我我期望从ls [A-Za-z]*获得的结果,这使我无法轻松获得仅以大写字母开头的该死的文件列表.我现在刚遇到grep的问题,直到我最终使用grep -P来获取Perl regex为止,我无法让它停止与[A-Z]匹配小写字母.

I've noticed for a while now that, on some of the Unix-based systems I use at least, ls [A-Z]* has been giving me the results I would anticipate from ls [A-Za-z]*, leaving me unable to easily get a list of just the goddamned files that start with capital letters. I just now ran into the same thing with grep, where I could not get it to stop matching lowercase letters with [A-Z] until I eventually used grep -P to get Perl regex.

所以我有一些相关的问题:

So I have some related questions:

  1. 这种蠢货是什么时候开始的?
  2. 谁负责并需要受到惩罚?
  3. 为什么?
  4. 对于lsgrep情况中的一个或两个,是否有一些合理简单的解决方法? (例如,尝试grep --no-ignore-case是徒劳的.grep -P并不是很好的解决方法,因为它具有实验功能状态.)
  1. When did this idiocy start?
  2. Who is responsible and needs to be punished?
  3. WHY???
  4. Is there some reasonably simple workaround for either or both of the ls and grep cases? (Trying, for example, grep --no-ignore-case was fruitless. grep -P is not a very good workaround because of its experimental feature status.)

推荐答案

它实际上是[A-Za-y],它与语言整理有关.如果要覆盖它,则适当地设置$LC_COLLATE;否则,请重新设置. CPOSIX都可以.

It's actually [A-Za-y], and it has to do with language collation. If you want to override it then set $LC_COLLATE appropriately; either of C or POSIX should do.

这篇关于[A-Z]表示[A-Za-z]的含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆