I've been assigned the task of converting our UNIX C shell scripts to DOS because I told them that it could be done and because we're moving to an all DOS/Windows environment from Solaris--what have I done? It just seems like you could so.... Here I am researching UNIX equivalents to DOS (e.g., GREP, SED, etc.). Through this group I've already some amazingly flexible code that I didn't think was possible using DOS batch files. That said...
My question is, can this be done? Is there anything like SED in DOS? I found that I could FIND instead of GREP to some extent.
Any tips or websites that might put me on my task's path would be appreciated. Thanks.
UNIX to DOS.
Moderator: DosItHelp
Re: UNIX to DOS.
`repl.bat` - download from: https://www.dropbox.com/s/qidqwztmetbvklt/repl.bat
`findrepl.bat` - download from: https://www.dropbox.com/s/rfdldmcb6vwi9xc/findrepl.bat
Repl.bat is sed-like
Findrepl.bat is grep-like
Both run using native Windows Jscript and are quick and robust - and will only require some adjustment to Windows regexp and the syntax.
Findrepl is by Aacini and Repl is by Dave Benham, and are both regulars here.
There are threads here for both tools also and the links are inside each of the batch files.
`findrepl.bat` - download from: https://www.dropbox.com/s/rfdldmcb6vwi9xc/findrepl.bat
Repl.bat is sed-like
Findrepl.bat is grep-like
Both run using native Windows Jscript and are quick and robust - and will only require some adjustment to Windows regexp and the syntax.
Findrepl is by Aacini and Repl is by Dave Benham, and are both regulars here.
There are threads here for both tools also and the links are inside each of the batch files.
Re: UNIX to DOS.
thanks foxidrive for the prompt response.
I'm a little confused though and please understand that I'm not familiar with all that can be done at the DOS command line. But how is Javascript being supported without a browser?
Thanks.
I'm a little confused though and please understand that I'm not familiar with all that can be done at the DOS command line. But how is Javascript being supported without a browser?
Thanks.
Re: UNIX to DOS.
Jscript is part of Windows Scripting Host (WSH for short) and is a different beast to Javascript.
VB scripts and Jscript can both be implemented through cscript.exe/wscript.exe and run natively in Windows since W2K from memory.
There was an optional download for Win 9x to support WSH.
Windows has Powershell that can be scripted also.
It is quite good but has a disadvantage in that scripts will not run on a machine by default, until you manually change the permissions for executing scripts.
VB scripts and Jscript can both be implemented through cscript.exe/wscript.exe and run natively in Windows since W2K from memory.
There was an optional download for Win 9x to support WSH.
Windows has Powershell that can be scripted also.
It is quite good but has a disadvantage in that scripts will not run on a machine by default, until you manually change the permissions for executing scripts.
Re: UNIX to DOS.
Why not just use the Windows Ports of all those nice tools you had on your Unix boxes.
http://unxutils.sourceforge.net/
http://gnuwin32.sourceforge.net/
While I do agree with trying to do everything with Native code it may help you transition better to Windows.
http://unxutils.sourceforge.net/
http://gnuwin32.sourceforge.net/
While I do agree with trying to do everything with Native code it may help you transition better to Windows.
Re: UNIX to DOS.
Squashman wrote:Why not just use the Windows Ports of all those nice tools you had on your Unix boxes.
While I do agree with trying to do everything with Native code it may help you transition better to Windows.
BTW. there are Windows Services for UNIX from M$ -
http://www.microsoft.com/en-us/download ... spx?id=274 - v3.5 for XP,2003
http://www.microsoft.com/en-us/download ... px?id=2391 - for Vista,7,2008
And they come with a bunch of command line tools including posix.exe ,x server , shell and so on.
But the size is a little bit bigger..
But when it comes to install external tools I would prefer cygwin:
Code: Select all
http://www.cygwin.com/
Re: UNIX to DOS.
jocor826 wrote:I've been assigned the task of converting our UNIX C shell scripts to DOS because I told them that it could be done and because we're moving to an all DOS/Windows environment from Solaris--what have I done? It just seems like you could so.... Here I am researching UNIX equivalents to DOS (e.g., GREP, SED, etc.). Through this group I've already some amazingly flexible code that I didn't think was possible using DOS batch files. That said...
My question is, can this be done? Is there anything like SED in DOS? I found that I could FIND instead of GREP to some extent.
Any tips or websites that might put me on my task's path would be appreciated. Thanks.
if you find that you often need to do this type of "conversion" from unix to Dos and from Dos to unix, my advice is to use a cross platform language. Perl Python Java etc does the job. You only need minor changes or no changes to port from one platform to another.