用 grep 匹配已有檔案中的多個字元,比如 48 ,用排序符號,輸入命令如下 grep 48 filename ,提示 grep Invalid collation charact

時間 2021-06-02 14:07:10

1樓:jesse

[.48.] by default is not defined to be treated as an atom in bracket expression.

You need to define [.48.] in locale before using it.

Reference from(Regular Expressions):

A collating symbol is a collating element enclosed within bracket-period ( "[." and ".]" ) delimiters.

Collating elements are defined as described in Collation Order.

Conforming

collating symbols when it is necessary to distinguish them from

a list of the individual characters that make up the multi-character

collating element. For example, if the string "ch" is

a collating element defined using the line:

collating-element from ""

in the locale definition, the expression "[[.ch.]]" shall be treated as an RE containing the collating symbol

'ch', while "[ch]" shall be treated as an RE matching 'c' or 'h'. Collating symbols are

recognized only inside bracket expressions. If the string is not a collating element in the current locale, the expression is

invalid.

2樓:依雲

regex(7) 裡有對於此語法的說明:

Within a bracket expression, a collating element (a character, a multicharacter sequence that collates as if it were a single character, or a collating-sequence name for either) enclosed in "[." and ".]" stands for the sequence of characters of that collating element.

但是「48」不是乙個字元,不是乙個被作為單個字元排序的多字元,也不是乙個排序序列名。

你們對於秒倒隊友賽後說 「匹配而已」有什麼看法?

xxx 原諒ta唄,所有人對待遊戲的態度不同 ta可能只是想娛樂一下,放放鬆只要排位給力就沒必要噴第五人格本來就是遊戲,遊戲就是讓人放鬆的,我總不能不讓ta玩吧? 啊這 有一說一,第五人格作為乙個遊戲最重要的是遊戲體驗而不是上分,你自己技術差,剛玩導致別人的遊戲體驗不好,可以理解。但是你要是都是推卸...

甲骨文的冊字能說明商朝已有簡冊麼?

explorer 可以說明當時就有簡冊。本身甲骨文卜辭就有自右向左寫的習慣,這就是有竹簡才帶來的習慣。商代的史官在甲骨文和金文中又被稱為 作冊X 可見 冊 就是史料和典籍。尚書 多士 惟殷先人,有典有冊。但問題是,現代考古發現的竹簡最早還只到戰國時期 而且基本上是楚國的 就連春秋時期的竹簡都沒發現過...

用正規表示式匹配非括號內的資料

蒼爾貓鹿 js實現如下 varreg g var source cc while result reg exec source 將括號作為邊界,括號之間的內容作為第乙個分組,用全域性匹配模式,迴圈匹配,每次匹配得到乙個陣列,其中下標為1的即為第乙個分組,也就是括號之間的內容。 梁濤 解法一如果你用的...