cd /var/www/html
touch file
2003:22:32 user1 index.php
2003:22:40 user1 a.php
2003:22:45 user1 b.php
2003:22:50 user2 index.php
2003:22:53 user2 show.php
2003:22:56 user2 abc.php
2004:22:32 user1 index.php
2004:22:40 user1 a.php
2004:22:45 user1 b.php
2004:22:50 user2 index.php
2004:22:53 user2 show.php
2004:22:56 user2 abc.php
a
b
c
d
1
2
3
4
php
hp
ap
bp
p
35
40
60
70
80
90
99
2
22
222
2222
22222
222222
60root@localhost:/var/www/html#grep -E '200:22:5[0-9]' file
root@localhost:/var/www/html#grep -Ev '^2004' file
root@localhost:/var/www/html#grep -Ev '^2003|^2004' file
root@localhost:/var/www/html#grep -Ev '^[^1234]' file
root@localhost:/var/www/html#grep -E '^[^1234]' file
root@localhost:/var/www/html#grep -E 'h*p' file
root@localhost:/var/www/html#grep -E 'h+p' file
root@localhost:/var/www/html#grep -E '[6-9][0-9]' file
root@localhost:/var/www/html#grep -E '2{2,4}' file
root@localhost:/var/www/html#grep -E '2{2,4}$' file
root@localhost:/var/www/html#grep -E '2{2,}' file
[root@db3 yansiyu]# grep -E '\b2{3,4}$' file
222
2222
root@localhost:/var/www/html#grep -E '^d' file
root@localhost:/var/www/html#grep -E '^[^d]' file
[root@db3 yansiyu]# grep -E '90|99' file
90
99
[root@db3 yansiyu]# grep -E '^hhp|^php' file
hhp
php
[root@db3 yansiyu]# grep -E ^[^php] test.php
2003:22:32 user1 index.php
2003:22:40 user1 a.php
2003:22:45 user1 b.php
2003:22:50 user2 index.php
2003:22:53 user2 show.php
2003:22:56 user2 abc.php
2004:22:32 user1 index.php
2004:22:40 user1 a.php
2004:22:45 user1 b.php
2004:22:50 user2 index.php
2004:22:53 user2 show.php
2004:22:56 user2 abc.php
a
b
c
d
1
2
3
4
ap
bp
35
40
60
70
80
90
99
2
22
222
2222
22222
222222
[root@db3 yansiyu]# grep -E '^(php|hp)' test.php
php
hp
[root@db3 yansiyu]# grep -E '^php|^hp' test.php
php
hp