"Could you grep that for me?". Somehow grep beats any Windows equivalent text search tool I know of. I even use my Linux based machine to "grep" information in log files from Windows based machines.
Perhaps this is the most famous and well known command among IT geeks.
Grep supports searching in multiple files stored in multiple directories on any mount point on your machine. Sometimes you have to find something in a log file. But lets say you don't know in which log file you should start. Then the recursive flag would offer an outcome. I won't go into great detail here but these iterations of the grep command I use the most. Obviously this nifty tool can do a lot more than what I am writing here. Regular expressions for example. The full manual can be found here.
Plain grep
grep "{search string}" /some/file
Case insensitive grep
grep -i "{search string}" /some/file
Recursive grep
grep -r "{search string}" /some/directory
Case insensitive and recursive grep
grep -ir "{search string}" /some/directory
Exclude lines with a specific character
grep -v "#" /some/config/file
No comments:
Post a Comment