亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫(kù)
12下一頁(yè)
最近訪問(wèn)板塊 發(fā)新帖
查看: 4816 | 回復(fù): 13
打印 上一主題 下一主題

『求助』文件名匹配問(wèn)題 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2005-11-25 12:04 |只看該作者 |倒序?yàn)g覽
有如下文件:
CHARBASE046.MYD
CHARBASE046.MYI
CHARBASE047.frm
CHARBASE047.MYD
CHARBASE047.MYI
CHARBASE048.frm
CHARBASE048.MYD
CHARBASE048.MYI
CHARBASE049.frm
CHARBASE049.MYD
CHARBASE049.MYI
CHARBASE.frm
CHARBASE.MRG

要將其中CHARBASE.* 和 CHARBASE049.*所有文件拷貝到其他目錄,
請(qǐng)問(wèn)在命令行下怎樣用正則表達(dá)式匹配這5個(gè)文件名,如果不考慮使用管道,應(yīng)該怎么寫(xiě)這個(gè)命令?
謝謝

論壇徽章:
1
榮譽(yù)會(huì)員
日期:2011-11-23 16:44:17
2 [報(bào)告]
發(fā)表于 2005-11-25 12:11 |只看該作者

  1. ls /path CHARBASE.* CHARBASE049.*|xargs -i cp {} /otherpath
復(fù)制代碼

論壇徽章:
8
摩羯座
日期:2014-11-26 18:59:452015亞冠之浦和紅鉆
日期:2015-06-23 19:10:532015亞冠之西悉尼流浪者
日期:2015-08-21 08:40:5815-16賽季CBA聯(lián)賽之山東
日期:2016-01-31 18:25:0515-16賽季CBA聯(lián)賽之四川
日期:2016-02-16 16:08:30程序設(shè)計(jì)版塊每日發(fā)帖之星
日期:2016-06-29 06:20:002017金雞報(bào)曉
日期:2017-01-10 15:19:5615-16賽季CBA聯(lián)賽之佛山
日期:2017-02-27 20:41:19
3 [報(bào)告]
發(fā)表于 2005-11-25 12:33 |只看該作者
cp  CHARBASE{,049}.* otherpath/

論壇徽章:
1
榮譽(yù)會(huì)員
日期:2011-11-23 16:44:17
4 [報(bào)告]
發(fā)表于 2005-11-25 12:36 |只看該作者
原帖由 waker 于 2005-11-25 12:33 發(fā)表
cp  CHARBASE{,049}.* otherpath/

原來(lái)還可以這樣 `~~`

論壇徽章:
0
5 [報(bào)告]
發(fā)表于 2005-11-25 13:03 |只看該作者
原帖由 寂寞烈火 于 2005-11-25 12:11 發(fā)表

  1. ls /path CHARBASE.* CHARBASE049.*|xargs -i cp {} /otherpath
復(fù)制代碼


我還是喜歡這種用法

論壇徽章:
0
6 [報(bào)告]
發(fā)表于 2005-11-25 14:15 |只看該作者
多謝各位幫助 感激不盡啊。
想了很久就是不知道寫(xiě)。

waker 的用法很經(jīng)典,剛才用了果然可以。
原帖由 waker 于 2005-11-25 12:33 發(fā)表
cp  CHARBASE{,049}.* otherpath/


可否解釋一下{,049}中逗號(hào)的用法,以前從來(lái)沒(méi)有看到過(guò)這個(gè)元字符,孤陋寡聞,還望點(diǎn)撥一下。




另外{,049}.* 中那個(gè).號(hào)在這里到時(shí)普通的字符還是匹配符,*號(hào)在這里到底是普通意思上的匹配還是正則表達(dá)式中的匹配?  看著這.*越看越糊涂。

[ 本帖最后由 另一只 于 2005-11-25 15:26 編輯 ]

論壇徽章:
0
7 [報(bào)告]
發(fā)表于 2005-11-26 10:57 |只看該作者
兄弟們,麻煩指點(diǎn)一下,發(fā)現(xiàn)下面的命令也可以:
cp  CHARBASE{,049}.** otherpath/     就是弄不明白, . * 的意思

引申一下:
要是文件如下
CHARBASE046.MYD
CHARBASE046.MYI
CHARBASE047.frm
CHARBASE047.MYD
CHARBASE047.MYI
CHARBASE048.frm
CHARBASE048.MYD
CHARBASE049049.MYI
CHARBASE049.frm
CHARBASE049.MYD
CHARBASE049.MYI
CHARBASE.frm
CHARBASE.MRG

用正則表達(dá)式一次匹配復(fù)制上面6個(gè)藍(lán)色文件名,該怎么寫(xiě)命令啊


[ 本帖最后由 另一只 于 2005-11-29 18:26 編輯 ]

論壇徽章:
1
榮譽(yù)會(huì)員
日期:2011-11-23 16:44:17
8 [報(bào)告]
發(fā)表于 2005-11-26 12:58 |只看該作者
man bash,見(jiàn) Brace Expansion 段的描述

論壇徽章:
0
9 [報(bào)告]
發(fā)表于 2005-11-29 15:48 |只看該作者
謝謝樓上兄弟

論壇徽章:
0
10 [報(bào)告]
發(fā)表于 2005-11-29 17:43 |只看該作者
Brace Expansion
       Brace expansion is a mechanism by which arbitrary strings may be gener-
       ated.  This mechanism is similar to pathname expansion, but  the         file-
       names generated need not exist.        Patterns to be brace expanded take the
       form of an optional preamble, followed by a series  of  comma-separated
       strings        between         a pair of braces, followed by an optional postscript.
       The preamble is prefixed to each string contained  within  the  braces,
       and the postscript is then appended to each resulting string, expanding
       left to right.

       Brace expansions may be nested.        The results of        each  expanded        string
       are  not         sorted;  left        to  right  order  is  preserved.  For example,
       a{d,c,b}e expands into `ade ace abe'.

       Brace expansion is performed before any other expansions, and any char-
       acters  special to other expansions are preserved in the result.         It is
       strictly textual.  Bash does not apply any syntactic interpretation  to
       the context of the expansion or the text between the braces.

       A  correctly-formed  brace  expansion must contain unquoted opening and
       closing braces, and at  least  one  unquoted  comma.   Any  incorrectly
       formed  brace expansion is left unchanged.  A { or , may be quoted with
       a backslash to prevent its being considered part of a brace expression.
       To  avoid conflicts with parameter expansion, the string ${ is not con-
       sidered eligible for brace expansion.

       This construct is typically used as shorthand when the common prefix of
       the strings to be generated is longer than in the above example:

              mkdir /usr/local/src/bash/{old,new,dist,bugs}
       or
              chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}

       Brace  expansion         introduces  a        slight incompatibility with historical
       versions of sh.        sh does not treat opening or closing braces  specially
       when  they  appear as part of a word, and preserves them in the output.
       Bash removes braces from words as a  consequence         of  brace  expansion.
       For  example,  a word entered to sh as file{1,2} appears identically in
       the output.  The same word is output as file1 file2 after expansion  by
       bash.   If strict compatibility with sh is desired, start bash with the
       +B option or disable brace expansion with the +B option to the set com-
       mand (see SHELL BUILTIN COMMANDS below).
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專(zhuān)區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過(guò)ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP