如何运行GnuWin32 sed和脚本文件?

如何运行GnuWin32 sed和脚本文件?,sed,Sed,我正在windows10下运行GnuWin32 我正在尝试使用Gnu Bash shell运行以下sedone行程序: sed -f <(sed -E 's_(.+)\t(.+)_s/\1/\2/g_' C:/dictionary.txt) C:/content.txt content.txt如下所示: aluminium<tab>aluminum analyse<tab>analyze white spirit<tab>mineral spirits

我正在
windows10
下运行
GnuWin32

我正在尝试使用Gnu Bash shell运行以下
sed
one行程序:

sed -f <(sed -E 's_(.+)\t(.+)_s/\1/\2/g_' C:/dictionary.txt) C:/content.txt
content.txt
如下所示:

aluminium<tab>aluminum
analyse<tab>analyze
white spirit<tab>mineral spirits
stag night<tab>bachelor party
savoury<tab>savory
potato crisp<tab>potato chip
mashed potato<tab>mashed potatoes
The container of white spirit was made of aluminium.
We will use an aromatic method to analyse properties of white spirit.
No one drank white spirit at stag night.
Many people think that a potato crisp is savoury, but some would rather eat mashed potato.
...
more sentences
在windows 10下的GnuBash shell中运行GnuWin32/sed时,我收到以下错误消息:
意外标记附近的语法错误一种方法是先将内部sed输出写入临时文件,使用它,然后删除它:

sed -r "s_(.+)\t(.+)_s/\1/\2/g_" C:/dictionary.txt>tmp_script.sed
sed -f tmp_script.sed C:/content.txt
del tmp_script.sed
另一种方法是,根据马克·塞切尔先生的评论,再加上一些小改动,安装了
cygwin

在bash和批处理上的工作如下:

sed -r "s_(.+)\t(.+)_s/\1/\2/g_" C:/dictionary.txt | sed -f /dev/stdin C:/content.txt

也许试着把所有的东西放在代码里面>你可以试着用<代码> -r<代码>代替<代码> -e代码> >你也似乎已经下降了<代码> /DEV/STDIN < /代码> -考虑把它放回或使用<代码> ->代码>在它的位置。谢谢你@马克Setchell@JayGray我改了一点,临时文件的方式现在可能可以用了。我不确定,但cygwin可能还是个不错的选择。(您可能需要删除GNUwin32以避免冲突)很抱歉,我之前误导了您。