Hello all,
I am running Stata 13.1 on a Windows 7 machine.
I have a project with lots of existing code written for a Linux environment. Unfortunately, at present I must use a Windows environment.
One line of the Linux code is written below. Is there a way to get this command to run from within Stata on a Windows machine?
!zcat /dir1/dir2/testfile.zip | cut –d , -f 2,5,13-83 > testfile.txt
This command cuts specific columns from a zip file and then saves only those columns to a text file.
Of course, the “zcat” utility is not available for Windows.
One option for solving my problem would be to find a way to accomplish the above Linux command with Windows and Stata code. However, this would require re-writing all the existing Linux code, so it would be preferable to get the Linux commands to run with Stata in Windows.
Here is what I’ve tried so far:
Many thanks,
Nicolas
I am running Stata 13.1 on a Windows 7 machine.
I have a project with lots of existing code written for a Linux environment. Unfortunately, at present I must use a Windows environment.
One line of the Linux code is written below. Is there a way to get this command to run from within Stata on a Windows machine?
!zcat /dir1/dir2/testfile.zip | cut –d , -f 2,5,13-83 > testfile.txt
This command cuts specific columns from a zip file and then saves only those columns to a text file.
Of course, the “zcat” utility is not available for Windows.
One option for solving my problem would be to find a way to accomplish the above Linux command with Windows and Stata code. However, this would require re-writing all the existing Linux code, so it would be preferable to get the Linux commands to run with Stata in Windows.
Here is what I’ve tried so far:
- Installed Cygwin; attempted to integrate Cygwin with windows command prompt. Basic Linux commands would work correctly (ls, cd, pwd, etc), but zcat (and others) would not. This may be due to incompatibilities between Cygwin and command prompt on a 64-bit machine, or maybe an issue with system paths that I’m not familiar with. In any case, I have not been able to get this to work correctly. If I did get Linux commands to run from command prompt via Cygwin, I think I would be able to leave the code written for Linux as-is by using Stata’s shell command followed by the original Linux code.
- Attempted to run Stata from within Cygwin. Apparently this is possible, but I have not been able to find any tutorials via google. It may simply be that I do not know the correct search terms. I believe this method of running Stata is referred to as “batch mode”, but so far I have not been able to get Stata to run at all from within Cygwin. Maybe I’m simply writing the code to get this started incorrectly?
Many thanks,
Nicolas
Comment