Powersehll: match ,cmatch,imatch命令

最近在学习Powershell,今天学习到用match命令作文字的匹配。

比方说: type person.cs | where {$_ –match ‘name’}

结果输出就会是把文件里所有的name输出到命令行上。 COOL! :)

 

但我的问题来了,如何能区分大小写,比方说我想只输出Name而不包括name.这就要用到cmatch,意思就是Case sensitive match.

把上面的命令简单改写一下就可以了。

type person.cs | where {$_ –cmatch ‘name’}

 

 

Powershell 的功能十分强大,值得我好好学习一下。 持续分享中。。。 :)

posted @ 2009-08-21 02:16  卜海清  阅读(891)  评论(0)    收藏  举报