This is an inquiry that is partly related to SPSS - but also related to Windows 7.
I’m trying to conduct a search/generate a list of all SPSS syntax files that contain certain words. For example, I want to search a drive for any SPSS syntax file (*.sps ) that includes the words DEFINE TABIT . I have tried Windows 7 Windows Explorer to conduct this search but continually come up empty. I also tried the search using the "content:DEFINE TABIT" approach in Windows Explorer. I also have tried the “Search Program and Files” option in the bottom left portion of the Windows 7 screen. I get no hits - even though I know I should be seeing some files that meet that criteria. It seems like this type of search was possible in the past (using Windows NT Windows Explorer and the old text editor in SPSS). I wonder if it may be somehow related to the SPSS Text Editor (which I recall became Java based around SPSS 16 ? ). Maybe the search engine has difficulty searching the file contents for those type of files? Thanks in advance for any suggestions. Dan |
SPSS Syntax files continue to remain plain
text. Anything searching such files would not be affected by the
newer editor.
However, if your syntax files are in Unicode, they will have a special 3-byte prefix, and any accented or extended characters in them are encoded in UTF-8. I would hope that Win 7-8 could cope with that as necessary (Win 7-8 are themselves natively Unicode). Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: Dan Conlon <[hidden email]> To: [hidden email], Date: 01/14/2013 06:12 PM Subject: [SPSSX-L] SEARCH FILE CONTENTS USING WINDOWS EXPLORER Sent by: "SPSSX(r) Discussion" <[hidden email]> This is an inquiry that is partly related to SPSS - but also related to Windows 7. I’m trying to conduct a search/generate a list of all SPSS syntax files that contain certain words. For example, I want to search a drive for any SPSS syntax file (*.sps ) that includes the words DEFINE TABIT . I have tried Windows 7 Windows Explorer to conduct this search but continually come up empty. I also tried the search using the "content:DEFINE TABIT" approach in Windows Explorer. I also have tried the “Search Program and Files” option in the bottom left portion of the Windows 7 screen. I get no hits - even though I know I should be seeing some files that meet that criteria. It seems like this type of search was possible in the past (using Windows NT Windows Explorer and the old text editor in SPSS). I wonder if it may be somehow related to the SPSS Text Editor (which I recall became Java based around SPSS 16 ? ). Maybe the search engine has difficulty searching the file contents for those type of files? Thanks in advance for any suggestions. Dan -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/SEARCH-FILE-CONTENTS-USING-WINDOWS-EXPLORER-tp5717372.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
In reply to this post by Dan Conlon
below is one of the solutions i received in 2006 to the same inquiry. You can find other solutions that were sent to me by looking at the string of emails under the subject listed below in the archives.
HTH. bozena Thank you. it worked. WINXP will find words or phrases in many other kinds of files but not .sps files! Art jaredp wrote: > Prepare to be excited! > > Unix and Linux systems have a command called GREP which allows to > search for > a string of text within files. > > You are in luck because you can download a piece of software for the > Windows > operating system which will do the same thing. Get it here > http://astrogrep.sourceforge.net/ > > This software is free as in price and free as in freedom (it is > provided for > anyone to use under an open source license). > > Jared > > On 7/28/06, Zdaniuk, Bozena <[hidden email]> wrote: > >> >> I was never successful in searching for any text string in spss syntax >> files and will be very excited to see a solution to it! >> Bozena >> >> Bozena Zdaniuk, Ph.D. >> >> University of Pittsburgh >> >> UCSUR, 6th Fl. >> >> 121 University Place >> >> Pittsburgh, PA 15260 >> >> Ph.: 412-624-5736 >> >> Fax: 412-624-4810 >> >> email: [hidden email] >> >> -----Original Message----- >> From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of >> Art Kendall >> Sent: Friday, July 28, 2006 12:53 PM >> To: [hidden email] >> Subject: using winxp "search" for words in .SPS files >> >> I tried using the <start> <search> <all files and folders> I entered >> *.sps in the edit box and browse to a folder. >> this works to find all .sps files in a folder. >> However, when I enter a string like "aggregate" in the word or phrase >> edit box, it does does not find the files with that command. >> does anyone else experience this? Has anyone come up with a workaround? >> >> I am running Win XP with a patches up to date. >> >> Art >> > > From: SPSSX(r) Discussion [[hidden email]] on behalf of Dan Conlon [[hidden email]] Sent: Monday, January 14, 2013 3:20 PM To: [hidden email] Subject: SEARCH FILE CONTENTS USING WINDOWS EXPLORER This is an inquiry that is partly related to SPSS - but also related to Windows 7. I’m trying to conduct a search/generate a list of all SPSS syntax files that contain certain words. For example, I want to search a drive for any SPSS syntax file (*.sps ) that includes the words DEFINE TABIT . I have tried Windows 7 Windows Explorer to conduct this search but continually come up empty. I also tried the search using the "content:DEFINE TABIT" approach in Windows Explorer. I also have tried the “Search Program and Files” option in the bottom left portion of the Windows 7 screen. I get no hits - even though I know I should be seeing some files that meet that criteria. It seems like this type of search was possible in the past (using Windows NT Windows Explorer and the old text editor in SPSS). I wonder if it may be somehow related to the SPSS Text Editor (which I recall became Java based around SPSS 16 ? ). Maybe the search engine has difficulty searching the file contents for those type of files? Thanks in advance for any suggestions. Dan -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/SEARCH-FILE-CONTENTS-USING-WINDOWS-EXPLORER-tp5717372.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
In reply to this post by Dan Conlon
Are you files on you
machine or on a server?
Do you have the files in a folder call MY Documents? Do did or are they in a folder called program files? In Windows some folders can be hidden. especially those under "program files". Unless you diddle the search specifications search will not find them. I don't have windows 7 at hand but try this. Use windows explorer to open a folder that has a file that you know has the string you are looking for. Back up one level in the tree. right click on the folder name click <general>� � see if hidden is checked. keep going back up the tree to see if that is the problem. Art Kendall Social Research ConsultantsOn 1/14/2013 6:20 PM, Dan Conlon wrote: This is an inquiry that is partly related to SPSS - but also related to Windows 7. I’m trying to conduct a search/generate a list of all SPSS syntax files that contain certain words. For example, I want to search a drive for any SPSS syntax file (*.sps ) that includes the words DEFINE TABIT . I have tried Windows 7 Windows Explorer to conduct this search but continually come up empty. I also tried the search using the "content:DEFINE TABIT" approach in Windows Explorer. I also have tried the “Search Program and Files” option in the bottom left portion of the Windows 7 screen. I get no hits - even though I know I should be seeing some files that meet that criteria. It seems like this type of search was possible in the past (using Windows NT Windows Explorer and the old text editor in SPSS). I wonder if it may be somehow related to the SPSS Text Editor (which I recall became Java based around SPSS 16 ? ). Maybe the search engine has difficulty searching the file contents for those type of files? Thanks in advance for any suggestions. Dan -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/SEARCH-FILE-CONTENTS-USING-WINDOWS-EXPLORER-tp5717372.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Art Kendall
Social Research Consultants |
In reply to this post by Zdaniuk, Bozena-3
Thank you all for your suggestions.
I was not able to successfully conduct a file search/listing using Windows Explorer (Windows 7) based on a word search within sps files. The only solution that worked for me was that suggested by Bozena (i.e., use of astrogrep application http://astrogrep.sourceforge.net/ ). Thanks Bozena. In response to Art's suggestions regarding folders and hidden checkbox, the issues you presented did not pertain directly to my situation. I'm able to conduct successful searches using Windows Explorer on any of those folders when I limit the search to simply listing sps files (e.g., search for files d*.sps on my C: drive). The point at which the search fails is when I add more criteria to the search (e.g., search for files d*.sps on my C: drive containing the word suppserv). Thanks for the suggestions. I still don't understand why this doesn't work with Windows Explorer. So, I'll just move on and go with the tool that does the job for me right now (astrogrep). Thanks, Dan _________________________________________________________________________________ below is one of the solutions i received in 2006 to the same inquiry. You can find other solutions that were sent to me by looking at the string of emails under the subject listed below in the archives. HTH. bozena Thank you. it worked. WINXP will find words or phrases in many other kinds of files but not .sps files! Art jaredp wrote: > Prepare to be excited! > > Unix and Linux systems have a command called GREP which allows to > search for > a string of text within files. > > You are in luck because you can download a piece of software for the > Windows > operating system which will do the same thing. Get it here > http://astrogrep.sourceforge.net/ > > This software is free as in price and free as in freedom (it is > provided for > anyone to use under an open source license). > > Jared > > On 7/28/06, Zdaniuk, Bozena <[hidden email]> wrote: > >> >> I was never successful in searching for any text string in spss syntax >> files and will be very excited to see a solution to it! >> Bozena >> >> Bozena Zdaniuk, Ph.D. >> >> University of Pittsburgh >> >> UCSUR, 6th Fl. >> >> 121 University Place >> >> Pittsburgh, PA 15260 >> >> Ph.: 412-624-5736 >> >> Fax: 412-624-4810 >> >> email: [hidden email] |
In reply to this post by Dan Conlon
If you adjust the way *.sps are indexed in Windows, you can do full text searches of syntax files.
Go to Start button->Control Panel->Indexing Options->Advanced In the Advanced Options Dialogue box, click the File Types tab, scroll down and highlight the entry for *.sps Select "Index Properties and File Contents" under "How should this file be indexed?" Click OK, let the index rebuild, and Windows' search will locate specific terms in syntax files using the "content: " search terms. You can also do the same for *.sbs to be able to do full text searches scripts as well. |
Thanks for the suggestion. It seems like I tried something similar previously - but something was off. Your steps work well.
In the meantime since my original posting, I have successfully used the search application I mentioned on the listserve (http://sourceforge.net/projects/astrogrep/)
. It is free and actually is pretty slick. Seems a little faster than the indexed search in Windows Explorer and has some other helpful features. Astrogrep can also be included as one of the search options within Windows Explorer. Thanks again, Dan Dan Conlon, Research Program Manager Healthcare Services Washington State Health Care Authority PO Box 45530 Olympia, WA 98504-5530 Phone: 360-725-1662 Fax: 360-664-4371 From: JFletcher [via SPSSX Discussion] [mailto:ml-node+[hidden email]]
If you adjust the way *.sps are indexed in Windows, you can do full text searches of syntax files.
If you reply to this email, your message will be added to the discussion below: To unsubscribe from SEARCH FILE CONTENTS USING WINDOWS EXPLORER,
click here. NOTICE: This message (including any attachments) may contain information that is privileged, confidential, proprietary and/or otherwise protected from disclosure to anyone other than its intended recipient(s). Any dissemination, copying, retention or use of this message or its contents (including any attachments) by persons other than the intended recipient(s) is strictly prohibited. If you have received this message in error, please immediately notify the sender by reply e-mail or telephone and permanently delete all copies of this message and any attachments. Thank you for your cooperation. |
In reply to this post by JFletcher
Oh, why did they hide that feature so well in W7. And is indexing allowed for non-admins?
Alternatively:
import re
import os def scanFiles(word="someWord", regex=True, caseless=True, extensions=[".sps"], *args, **kwargs):
"""Scan files recursively for 'word'.""" print "**************\nLooking for %r\n**************\n" % word word = re.escape(word) if not regex else word pattern = re.compile("(?i)" + word if caseless else word, re.M) for root, dirs, files in os.walk(*args, **kwargs): for file_ in files: try: extension = file_[file_.rindex("."):].lower() except ValueError: extension = "" if extension in extensions: print "... found %s" % file_ with open(os.path.join(root, file_), "rb") as f: if pattern.search(f.read()): print "--->", file_ break scanFiles(top="q:/someDir", word="DEFINE TABIT") Regards,
Albert-Jan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
In reply to this post by Dan Conlon
If you are comfortable in the DOS environment you can use FindStr
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/findstr.mspx?mfr=true http://technet.microsoft.com/en-us/library/bb490907.aspx Alt+R, enter 'cmd' in the DOS window enter something like (untested - no DOS access on this computer) cd \ findstr /i /m /s "DEFINE TABIT" C:\*.SPS >"C:\USERS\myUserName\DESKTOP\TABIT.TXT" The switches: /i : Specifies that the search is not to be case-sensitive. /m : Prints only the file name if a file contains a match. /s : Searches for matching files in the current directory and all subdirectories. > sends the output to a text file (TABIT.TXT) on your desktop, provided the path is correct... There is always the command findstr /? to get (minimal) help. |
Free forum by Nabble | Edit this page |