Grep Command

grep -ir word *

Search all files for keyword "word" in current folder and sub-folders

grep -ir -e word1 -e word2 *

Search all files for keyword "word1" or "word2" in current folder and sub-folders

grep -v word

Search all files exclude keyword "word" in current folder and sub-folders

cat file | grep -o '[^:]*$'

cat the file and using grep to find the last field (cut ":" )

grep -vFxf /tmp/exclude /tmp/all

Compare two files the to show the context wihtout exclude list, such as:
/tmp/exclude	/tmp/all
111 111 222 222 333 333 444 555
The result only show :
444
555

grep -Fxf /tmp/exclude /tmp/all

Compare two files the to show the match context, such as:
/tmp/file1	/tmp/file2
111 111 222 222 333 333 444 555
The result only show :
111
222
333



Server is hosted by Alanstudio
Linux Operating System

Recommend screen resolution 1024 x 768 / IE / FireFox
Alan Studio © 2007 by Alan Cheung Hin Lun. All rights reserved.