Quantcast

Update many files 'drive letter' references in various statements.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Update many files 'drive letter' references in various statements.

Jim Angel
All,

I'm an IT professional but a SPSS rookie - so forgive my ignorance. I am working on migrating our shared storage to a new location (for the sake of this email, let's say I am moving the "S:\" drive to a "D:\" drive - but all the content will remain the same). One of the departments is very concerned about all of the hard coded old drive paths being updated.

In preparation, I reviewed some of the original files and see things like:

GET DATA /TYPE=XLSX
/FILE='S:\....

    or

SAVE TRANSLATE OUTFILE='S:\...


Is there a simple way to update many (100+) files to change S:\ to D:\ without having to use 'find and replace' within each SPSS document?

Lastly, I noticed that I am able to open a *.spss file with notepad++ and it's just a UTF-8 formatted file. If this is the case, could I write a basic script to edit the content (SED / AWK / etc) as plain text files or would that break the SPSS file / format?

Feel free to let me know if there's anything I'm overlooking during this migration. Many thanks in advance!

Jim Angel
Systems Engineer
===================== 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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Update many files 'drive letter' references in various statements.

Jon Peck
Syntax files are plain text.

Maybe you could set a SUBST to make the old location remain valid.

Too late for now, but encourage users to use a FILE HANDLE to abstract location information from the bowels of the files.  Even create a standard file that everyone runs via the INSERT command to set standard parameters such as file handles.


On Thu, Feb 16, 2017 at 10:27 AM Jim Angel <[hidden email]> wrote:
All,

I'm an IT professional but a SPSS rookie - so forgive my ignorance. I am working on migrating our shared storage to a new location (for the sake of this email, let's say I am moving the "S:\" drive to a "D:\" drive - but all the content will remain the same). One of the departments is very concerned about all of the hard coded old drive paths being updated.

In preparation, I reviewed some of the original files and see things like:

GET DATA /TYPE=XLSX
/FILE='S:\....

    or

SAVE TRANSLATE OUTFILE='S:\...


Is there a simple way to update many (100+) files to change S:\ to D:\ without having to use 'find and replace' within each SPSS document?

Lastly, I noticed that I am able to open a *.spss file with notepad++ and it's just a UTF-8 formatted file. If this is the case, could I write a basic script to edit the content (SED / AWK / etc) as plain text files or would that break the SPSS file / format?

Feel free to let me know if there's anything I'm overlooking during this migration. Many thanks in advance!

Jim Angel
Systems Engineer


=====================

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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Update many files 'drive letter' references in various statements.

Adrian Barnett-2
In reply to this post by Jim Angel
Hi Jim
There's at least one programmer's text editor that I know of which has a "Replace in files" command amongst its search-and-replace commands. You fill in the normal 'find this' and 'replace it with that' fields in the dialog box and then can tell it to confine the search to files with a given extension and to search a particular directory, and, optionally, its subdirectories. You can approve each 'hit' individually if you wish or just say 'do them all'.
I don't know how many other editors have this, but I suspect there is a good number. The one I use is payware, and I don't know if any of the freeware/shareware alternatives have it, but suspect there probably are some freebies that can do it.

As a general point, if you do a lot of writing of SPSS syntax, I would recommend finding a good text editor and using it. Good ones can save you a great deal of work and make you much more productive. Keyboard macros, automatic code-completion (requires being able to create custom language templates so you can give it SPSS' commands and control structures), auto-indent, column-wise operations, file-comparison /difference-highlighting are just some of the things good ones can do to save you work and prevent errors.
 
Regards,

Adrian
--
Adrian Barnett        | "It's always the trombone player"
                      | (Faye Dunaway in 'The Arrangement')
Email: [hidden email]



From: Jim Angel <[hidden email]>
To: [hidden email]
Sent: Friday, 17 February 2017, 3:57
Subject: Update many files 'drive letter' references in various statements.

All,

I'm an IT professional but a SPSS rookie - so forgive my ignorance. I am working on migrating our shared storage to a new location (for the sake of this email, let's say I am moving the "S:\" drive to a "D:\" drive - but all the content will remain the same). One of the departments is very concerned about all of the hard coded old drive paths being updated.

In preparation, I reviewed some of the original files and see things like:

GET DATA /TYPE=XLSX
/FILE='S:\....
    or
SAVE TRANSLATE OUTFILE='S:\...

Is there a simple way to update many (100+) files to change S:\ to D:\ without having to use 'find and replace' within each SPSS document?

Lastly, I noticed that I am able to open a *.spss file with notepad++ and it's just a UTF-8 formatted file. If this is the case, could I write a basic script to edit the content (SED / AWK / etc) as plain text files or would that break the SPSS file / format?

Feel free to let me know if there's anything I'm overlooking during this migration. Many thanks in advance!

Jim Angel
Systems Engineer
===================== 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
Loading...