Sed for windows
Solution 1:
C:\>sed sdf
sed: -e expression #1, char 3: Unterminated `s' command
C:\>echo aaa > f
C:\>sed -e "s/a/x/" < f
xaa
This is using sed
from unxutils
Solution 2:
Unlike the Unixes, the Windows command-line shell does not perform any word-splitting and does not strip away the quotes; the program just receives a single string containing the entire command line. This means that not all programs can follow the same quoting rules.
In this case, the GnuWin32 version of sed only supports one quoting style – "
double quotes "
. For example, in my tests the following works fine:
sed "s/foo/bar/"
You can also get sed
from Cygwin, along with a more-complete Unix-like system: shells, editors, other tools. It will be easier if you use a Unix shell for learning, to avoid such syntax issues in the future.