Reputation: 3
I have a file include some linux command and I want to run in on windows (DOS command). The command is:
cat tmp/$id/index.html | sed -e 's/ID/$id/g' > a;mv a tmp/$id/index.html
What is the similar command in MS-DOS? Thank you!
Upvotes: 0
Views: 991
Reputation: 1
There are many options.
You can try to install cygwin or download and install Git and use Git-bash or add the bin directory to your PATH so you can run this command on your CMD prompt.
Upvotes: 0
Reputation: 6453
DOS itself does not have support for that. You could try with a port of SED for DOS available here. If you can get Powershell, that's an option. Here's an example of using grep/sed with Powershell.
Upvotes: 0
Reputation: 5744
You could consider using powershell to do approximately the same thing. It supports cat
and mv
and you can get a sed
like equivalent by using %{_ -replace "expression", "replace"}
. Details here http://blogs.msdn.com/b/zainnab/archive/2007/07/09/grep-and-sed-with-powershell.aspx
Or consider using a linux like command prompt like bash which should be available through cygwin
Upvotes: 1
Reputation: 1274
I think this is impossible to do in "bare" command line (as you called DOS command), because cat and sed are separate utilities. If you want to port this script from Linux command shell to windows command line, I would advise you to download and install CygWin
Upvotes: 0
Reputation: 1244
The problem is that natively there is no equivalent command to sed. You have two options from my point of view. Either create a vb script that does what you want (It will not take 1 line though - more like 10-15 I guess), or use something like GnuWin32 that gives you the option to run unix commands in windows terminal.
Upvotes: 1