Friday, May 21, 2010

sort & uniq command

sort command is used to sort a file in alphabetical or numberical order.



uniq command is used to extract unique lines from a file.


Thursday, May 13, 2010

Grep command to compare two files

$ cat > a
aap
noot
mies
teun

$ cat > b
noot
vuur
kees
mies

$ grep -v -f b a
aap
teun

$ grep -v -f a b
vuur
kees

Source: http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1113632

Monday, March 1, 2010

Grep commands

Grep recursively into a directory
grep -r "string" ./

Grep ignore case and recursive
grep -ir "string" ./

Grep ignore case, recursive and specific file type
grep -ir --include=*.vhd "string" ./

Grep ignore case, recursive, specific file type and list only matching file name
grep -ir -l --include=*.vhd "string" ./

Grep ignore case, recursive, specific file type, list only matching file name and only whole word matching
grep -ir -l -w --include=*.vhd "string" ./