Shell文本处理 (3) grep 正则表达式

grep  't[ae]st'   myTxt    // 查找 tast 或test

grep  '[^g]oo'   myTxt    // 查找含有oo,但前面没有g

grep  '[^a-zA-Z]oo'   myTxt    //  查找含有oo,但前面没有字母

grep  '^the'   myTxt        // 查找the开头

grep  '^[a-z]'   myTxt        // 查找小写字母开头

grep  '^[^a-z]'   myTxt        // 查找不是小写字母开头

grep  '[a-z]$'   myTxt        // 查找小写字母结尾

grep  '\.$''   myTxt        // 查找.结尾

grep  '^S'     //查找空白行


---------------------------------------------

待续











posted @ 2015-02-19 18:14  lihui1625  阅读(94)  评论(0编辑  收藏  举报