Wednesday, May 19, 2010

grep -n ,-v , -c, -i


$grep -n root /etc/passwd
1:root:x:0:0:root:/root:/bin/bash
$

$cat hello.txt
hello
world
$grep -v hello hello.txt
world
$
$cat hello.txt
hello
world
helloo
$grep -c hello hello.txt
2
$grep -c helloo hello.txt
1
$
$cat hello.txt
hello
world
helloo
Hello

$grep hello hello.txt
hello
helloo
$grep -i hello hello.txt
hello
helloo
Hello
$