Results 1 to 10 of 15
sorry if this is in the wrong spot, but I want to search all the files in a directory for a piece of text...thanks for any help you guys can ...
- 04-24-2008 #1Just Joined!
- Join Date
- Apr 2008
- Posts
- 6
find test within files
sorry if this is in the wrong spot, but I want to search all the files in a directory for a piece of text...thanks for any help you guys can give me
- 04-24-2008 #2
try this
Which will search (grep) your home directory (~) and all subdirectories (-R) forCode:grep -R test ~
the text testIf we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)
My new blog. It's probably not as good as I think it is.
- 04-24-2008 #3Just Joined!
- Join Date
- Apr 2008
- Posts
- 6
I guess I forgot to say, but I'm using MINIX and -R is not an opinion within Minix, is there any other way to do this with -R?
- 04-24-2008 #4Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
- 04-24-2008 #5Just Joined!
- Join Date
- Apr 2008
- Posts
- 6
thanks guys for all your help and it all most works, but now when I run that command it gives me the message "grep: couldn't open"...any suggestions?
- 04-24-2008 #6Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
Does that happen with all the files? Do you have read permissions ver these files? If affirmative, can you post the exact error messages?
It should work as long as the find and grep tools are standard, I think. Though I don't have any experience with minix, to tell the truth.
Also, are these regular files or are they any other kind of files? (symlinks, sockets, device nodes and the like).
- 04-25-2008 #7
I don't know if this works in Minix, but I believe it should. Check if grep is there..
that way we can take the problem further if grep proves to be available, else check if grep is available for Minix.Code:which grep
PS: Output should be something like this:
Code:uholtz@atom:~$ which grep /bin/grep
- 04-25-2008 #8Just Joined!
- Join Date
- Apr 2008
- Posts
- 6
I do have read and write permission on all the files and "grep: couldn't open" is the exact message I get, and it displays it for every file in the directory. grep is also installed(/usr/bin/grep) and all the files are .h or .c files so I think I should be able to read from them
- 04-25-2008 #9Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
- 04-25-2008 #10Just Joined!
- Join Date
- Apr 2008
- Posts
- 6
I don't know what it is, but that didn't work either. it just gave me a message "ls: (); No such file or directory"...I thought I could use the grep command and some how pip the find command with it but so far have been unsuccessful


Reply With Quote
