search file's contents
We can use konquerer to search file's name,
how about the contents? My problem is I recovered my flash drive, many files names were changed, i am tired to open one by one to check their contents. Anything can help me to identify the files contents? |
if you must use konquerer, then
Alt+v Alt+v Alt+d or View --> View Mode --> details. You should see a "type" column Which will tell you the file type not all that useful, but it is a start |
I use grep to search for a string of text in one line of a file like this:
Code:
grep <text> <filename> Code:
find <directory> -type f -exec grep <text> {} + |
assumes they are text files
but yes perfect for finding text files with known content Another cli spin on this would be Code:
find <directory> -type f -exec file {} + text -- grep for document title binary document formats?, might be able to get something useful from strings Really depends on the number of files, and what they are |
They are pdf, excel and Word files.
So, how to do it? |
Quote:
but I see your predicament, I imagine you have quite a few files to deal with... grep *_might_* work, but you don't say you are looking for a particular file, just that you want to know the contents of all the files I assume so you can give them proper names.. But I shall have a think |
ok, a little follow up for PDF
( I will have to find some excel/word files ) this is POC ( proof of concept ) Code:
find /path/to/dir -type f -exec file {} ';' \ The first being that you have pdftotext installed Second .. that the first line of the pdf is a suitable file name ( both descriptive and with "valid" characters , at the moment "/" will break it... ) and others I have not thought about it won't actually do anything, just print commands obviously you should substitute the /path/to/.. to existing directories, pdfinfo instead of pdftotext might get "better" results if the title is embedded how many files do you have? that is an important question |
there are thousands of files, mainly pdf, docx, excel .
Let's say I want to find a file containing "LIM YING CHING", in a directory named C:\Backup , how to do it? |
1000s ?
ok yeah a lot I'm sure it can be done, not perfect but OK can it be done without access to files? not sure LIM YING CHING seems to be a name so you want all files that contain than name "LIM YING CHING" you could try the grep from earlier, but it will probably fail ( as pdf xls and doc are binary format ) I gave an example were I converted PDF documents to text, instead of using head -n, you could use grep "LIM YING CHING" but it is more complicated I can probably get something, but seeing as it it 1000s of files you might be better with a local data recovery service. Face to Face, same language. I can probably do it, but would be looking for some form of reciprocation. if someone local is already "setup" it will be cheaper ( and if you can stand over them, more private ) Just how important is the data? You probably don't want to hear this now, but usb drives are good for moving stuff, not backup or exclusive storage. |
This will help me?
Quote:
|
Quote:
their assumption was you were interested in plain text files, and looking for something specific. from the start I knew ( ok felt ) you were not we are in an almost imposible situation I can not give you a magic spell for what you want I can offer a service, but it is a service I can not give a 100% guarantee for pragmatically processing 1000s of pdf,doc, xls files is a little hit and miss I can probably make some sense , and get something "useful", then again maybe not, I have no idea what is in the files ( first line is a wile guess ) , and thus far I have not even looked at an excel or word document. From my view , these files are not worth much, since they were only on a usb flash drive. But this is because I know that USB flash drives are not for primary storage or backup.. So I know they are perhaps important Right now you have the files, they work bit have silly names You have 1000s, do you actually use them? look back over what you have posted Pretty much nothing.. I have been guessing at your needs and still you come back with nothing |
In Konqueror 4.8.x (the one on this computer), when you select "Tools-->Find Files" and the Find Files dialog opens, there is a tab labeled "Contents."
You can enter text you are searching for in "Containing Text" field. It's ultimately quicker to learn how to do this with command line tools, but this is a nice GUI tool for searching file contents. |
Try Perl; either use binmode directly eg http://www.cs.cf.ac.uk/Dave/PERL/node73.html or from CPAN, grab the pre-made modules to read each file type search.cpan.org
|
Quote:
|
Quote:
Yes, it does appear to work on them. |
All times are GMT -5. The time now is 04:55 AM. |