第八课 正则表达式
正则表达式 示例1(新建名为grep.txt文件) ooxx12121212ooxx ooxx 12121212 oox 12121212 1212 ooxx 1212 oo3xx oo4xx ooWxx oomxx $ooxx oo1234xx ooxyzxx 键入如下命令 grep "\(^[0-9]\|[^0-9][0-9]\)[0-9]\{2\}\([0-9][^0-9]\|[0-9]$\)" grep.txt grep -E "^[0-9]{4}[^0-9]|[^0-9][0-9]{4}[^0-9]|[^0-9][0-9]{4}$|^[0-9]{4}$" grep.txt 示例2(新建test文件) aaabbcaaa aa bbc aaa bb bbc bbb asgodssgoodsssagodssgood asgodssgoodsssagoodssgod sdlkjflskdjf3slkdjfdksl slkdjf2lskdjfkldsjl 键入如下指令 cat test 51 grep "a" test 52 grep "a\{3\}" test 53 grep "\<aaa" test 54 grep "\<aaa\>" test 55 grep "b" test 56 grep "b\{2,3\}" test 57 clear 58 cat test 59