how to use grep on searching a text on files
I usually use this syntax with these options:
grep <text or regexp> -nrwi <path>
* -n to show line number
* -r to find also in subfolders
* -w to search the whole word only, ie. “bill” text does not find “billings”, “bills”, “bombill” 🙂
* -i case-insensitive, ie. “upload” searches “Upload”, “uPlOAd”
other useful options:
* -l file names only
* -c lists all the files in the path and the number of occurences of that text in each file (does not include the line where the text was found). as for my convenience, I don’t use this, kinda annoying. hehe
to search for multiple strings, just separate grep syntax with the pipe symbol |Â
to search on the current folder, use asterisk *Â on path.
So who needs Netbeans as IDE when you can just use VIM, and grep all the way. 🙂