How to use grep to search for a specific variable..
One quick question, how do i use grep to look through all files in a folder for a specific variable . :D
|
This is the way I do it. There are shorter command strings, but I've not bothered to learn them.
Code:
find /xxx -print |xargs grep string |
What do you mean for "specific variable"? Grep by itself is not recursive, but you can consider using find to search for some or all the files inside a directory (and eventually its subdirectory) and issue grep on them. A way to do this is
Code:
find . -type f | xargs grep string Code:
find . -type f | xargs grep $var Edit: Quakeboy02 was faster than me in posting the replay ;) Sorry for redundancy! |
For instance i have a php or txt file and i want to look inside the script for a specific variable
I've seen it done like this grep -n -p 'whatever' - But that didnt work so any advice on how to make it work. Thanks Quote:
|
Do you mean:
> grep something * ?? |
All times are GMT -5. The time now is 06:37 PM. |