Nov 21, 2003 #1 hugheskbh Programmer Dec 18, 2002 37 US Can anyone tell me if there's a way to scan for a specific value within all the files of a directory with one command.
Can anyone tell me if there's a way to scan for a specific value within all the files of a directory with one command.
Nov 21, 2003 #3 PHV MIS Nov 8, 2002 53,708 FR You can try something like this: Code: grep 'ValueSearched' /path/to/dir/* If you get Arg list too long you can try this:[/code] cd /path/to/dir; grep 'ValueSearched' *[/code] If you still have too many files, try this: Code: cd /path/to/dir; ls | xargs grep 'ValueSearched' Hope This Help PH. Upvote 0 Downvote
You can try something like this: Code: grep 'ValueSearched' /path/to/dir/* If you get Arg list too long you can try this:[/code] cd /path/to/dir; grep 'ValueSearched' *[/code] If you still have too many files, try this: Code: cd /path/to/dir; ls | xargs grep 'ValueSearched' Hope This Help PH.
Nov 23, 2003 #4 kduffin Programmer Nov 11, 2003 25 US If you want to recursively search the directory and other directories that may be therein, try: find /path/to/dir -type f | xargs grep 'ValueSearched' Cheers, Keith Upvote 0 Downvote
If you want to recursively search the directory and other directories that may be therein, try: find /path/to/dir -type f | xargs grep 'ValueSearched' Cheers, Keith