标签:grep
grepgrep -c ‘root‘ /etc/passwdgrep -c ‘‘ /etc/passwd 统计文件总行数grep -n ‘root‘ /etc/passwdgrep ‘root‘ -c /etc/passwd;grep ‘‘/etc/passwd -c
head /etc/passwd |grep ‘root‘ -n
head -3 /etc/passwd |grep ‘root‘ -nv

grep ‘[0-9]‘ test.txt -n
grep ‘^#‘ test.txt -n

grep ‘[^0-9]‘ test.txt
grep ‘^[^0-9]‘ test.txt
grep -v ‘^[^0-9]‘ test.txt
grep ‘^[0-9]‘ test.txt
grep ‘r.t‘ test.txt
grep ‘r\*t‘ test.txt

egrep ‘r{2}t‘ test.txtegrep ‘r{2,}t‘ test.txtegrep ‘r{1,2}t‘ test.txt
egrep ‘r+t‘ test.txt
egrep ‘r?t‘ test.txt
egrep ‘root|rt’ test.txt
egrep ‘r(t|o)‘ test.txt
标签:grep
原文地址:http://blog.51cto.com/12606610/2082834