|
#1
| |||
| |||
| Searching for text inside of a file using grep. I'm trying to search for text inside all files in deep subdirectories on an external hard drive. I've read the man page for grep but I still can't seem to get Panther to find the files I'm looking for. When I place the file I eventually found on my desktop, grep finds the file without any problems. Any suggestions? |
|
#2
| ||||
| ||||
| What's the exact command you're using? It sounds like you're not specifying the correct search path -- like you're just searching in subfolders of your home folder.
__________________ Power Macintosh G4/500MHz "Yikes!" 10.4.11 Server • 1024MB • 3 x 120GB + 320GB • DVR-111D • 2 x Radeon 7000 PCI • 2 x 17" CRT MacBook 2.0GHz Core 2 Duo - White 10.5.5 • 2048MB • 80GB • CD-RW/DVD-ROM iPod Photo 60GB • iPod nano 1GB • AT&T DSL 6Mb/768k http://www.jeffhoppe.com |
|
#3
| |||
| |||
| This correctly finds the file when the it is on my desktop: grep -l "0.136" /Users/chemgeek/Desktop/*.* I have tried these and they do not find the file I needed: grep -r "0.136" /Volumes/LaCie\ Disk/chemgeek/Documents/9-28-04/Masters_Thesis_Chemistry/Chemical_Structures/*.* grep -l "0.136" /Volumes/LaCie\ Disk/chemgeek/Documents/9-28-04/Masters_Thesis_Chemistry/Chemical_Structures/*.* The hard drive the files are stored on is a LaCie Big Disk Extreme 320GB. http://www.lacie.com/products/product.htm?pid=10489 Last edited by chemistry_geek; December 12th, 2004 at 12:10 PM. |
|
#4
| ||||
| ||||
| did you try grep -lr "0.136" /Volumes/LaCie\ Disk/chemgeek/Documents/9-28-04/Masters_Thesis_Chemistry/Chemical_Structures/*.* ?
__________________ My current machine is an iMac Core 2 Duo 2.16 GHz 24" with MacOS X 10.5. My Apples are here. My oldest Apple was born in 1977. GS/P/>SS d-(++) s+: a+ C+(C) U* P L+ E--- W++ N- o+ K? w O-- M++ V PS+ PE+ Y- PGP t+ 5 X+ R tv-- b+++ DI++ D+ G e+++ h---- r+++ y? Time is not changing, I'm just traveling through time. |
|
#5
| |||
| |||
| yes, I tried that too; it did not work. |
|
#6
| ||||
| ||||
| If you're doing a recursive search, you shouldn't need to specify *.* - in fact, I think that might only look at subdirectories that have a dot in their names. If you specify the exact file name, rather than a globbing pattern, does it find it? what is the filename? what is its format (what if you added the -a option to make it treat binary files as text?)
__________________ What is the robbing of a bank compared to the founding of a bank? -- Bertold Brecht |
|
#7
| |||
| |||
| OK, I think I know why grep -lr "0.136" /Volumes/LaCie\ Disk/chemgeek/Documents/9-28-04/Masters_Thesis_Chemistry/Chemical_Structures/*.* didn't find the file the day I was searching for it. I had not yet updated the locate database. After I ran the daily and weekly system maintenance cron jobs, grep -lr "0.136" /Volumes/LaCie\ Disk/chemgeek/Documents/9-28-04/Masters_Thesis_Chemistry/Chemical_Structures/*.* found three files in less than one second, literally. Thank you all for your help and suggestions. I very much appreciate all the help I get from the members here. |
|
#8
| |||
| |||
| Quote:
The reason I was looking for a specific text pattern inside all of the files for my masters thesis is because I forgot the specific file name and folder(s) it could have been placed in. I remember the the text that was in the file, that's why I was using grep. The file I was looking for was a ChemDraw file that contains both binary and text information. When viewed in BBEdit, I see "gibberish" characters everywhere and a few places with text that I entered to explain a chemical reaction. |
![]() |
| Thread Tools | |
|
|