How to create an ANSI Code::Blocks build project files.
Since sed use the forward slash as a delimiter, every forward slash not used as a delimiter must be escaped by an backslash (\).
sed commands that are being used in the batch file written like normal sed commands, note I found out that two sed command with option "g" do not do what I thought they did. So, I re-wrote the bat to run each search and replace one at a time.
# Change Variable WX_SUFFIX to empty string
s/<Variable name="WX_SUFFIX" value="u" \/>/<Variable name="WX_SUFFIX" value="" \/>/g
# Remove option -DwxUSE_UNICODE
s/<Add option="-DwxUSE_UNICODE" \/>$//g
In order to use sed commands on the command line they must be quoted.
In Windows, double quotes are used.
In Linux, I think single quotes are used.
Since, under windows double quotes are used, every double quote in the sed command must be escaped by an backslash (\).
sed-ANSI.bat
SET PATH=C:\Program Files\GnuWin32\bin
sed "s/<Variable name=\"WX_SUFFIX\" value=\"u\" \/>/<Variable name=\"WX_SUFFIX\" value=\"\" \/>/g" src\CodeBlocks.cbp | sed "s/<Add option=\"-DwxUSE_UNICODE\" \/>$//g" > src\CodeBlocks-ansi.cbp
sed "s/<Variable name=\"WX_SUFFIX\" value=\"u\" \/>/<Variable name=\"WX_SUFFIX\" value=\"\" \/>/g" src\plugins\contrib\byogames\byogames.cbp | sed "s/<Add option=\"-DwxUSE_UNICODE\" \/>$//g" > src\plugins\contrib\byogames\byogames-ansi.cbp
sed "s/<Variable name=\"WX_SUFFIX\" value=\"u\" \/>/<Variable name=\"WX_SUFFIX\" value=\"\" \/>/g" src\plugins\contrib\cb_koders\cb_koders.cbp | sed "s/<Add option=\"-DwxUSE_UNICODE\" \/>$//g" > src\plugins\contrib\cb_koders\cb_koders-ansi.cbp
sed "s/<Variable name=\"WX_SUFFIX\" value=\"u\" \/>/<Variable name=\"WX_SUFFIX\" value=\"\" \/>/g" src\plugins\contrib\codesnippets\codesnippets.cbp | sed "s/<Add option=\"-DwxUSE_UNICODE\" \/>$//g" > src\plugins\contrib\codesnippets\codesnippets-ansi.cbp
sed "s/<Variable name=\"WX_SUFFIX\" value=\"u\" \/>/<Variable name=\"WX_SUFFIX\" value=\"\" \/>/g" src\plugins\contrib\codestat\codestat.cbp | sed "s/<Add option=\"-DwxUSE_UNICODE\" \/>$//g" > src\plugins\contrib\codestat\codestat-ansi.cbp
sed "s/<Variable name=\"WX_SUFFIX\" value=\"u\" \/>/<Variable name=\"WX_SUFFIX\" value=\"\" \/>/g" src\plugins\contrib\copystrings\copystrings.cbp | sed "s/<Add option=\"-DwxUSE_UNICODE\" \/>$//g" > src\plugins\contrib\copystrings\copystrings-ansi.cbp
sed "s/<Variable name=\"WX_SUFFIX\" value=\"u\" \/>/<Variable name=\"WX_SUFFIX\" value=\"\" \/>/g" src\plugins\contrib\devpak_plugin\DevPakPlugin.cbp | sed "s/<Add option=\"-DwxUSE_UNICODE\" \/>$//g" > src\plugins\contrib\devpak_plugin\DevPakPlugin-ansi.cbp
sed "s/<Variable name=\"WX_SUFFIX\" value=\"u\" \/>/<Variable name=\"WX_SUFFIX\" value=\"\" \/>/g" src\plugins\contrib\dragscroll\dragscroll.cbp | sed "s/<Add option=\"-DwxUSE_UNICODE\" \/>$//g" > src\plugins\contrib\dragscroll\dragscroll-ansi.cbp
sed "s/<Variable name=\"WX_SUFFIX\" value=\"u\" \/>/<Variable name=\"WX_SUFFIX\" value=\"\" \/>/g" src\plugins\contrib\envvars\envvars.cbp | sed "s/<Add option=\"-DwxUSE_UNICODE\" \/>$//g" > src\plugins\contrib\envvars\envvars-ansi.cbp
sed "s/<Variable name=\"WX_SUFFIX\" value=\"u\" \/>/<Variable name=\"WX_SUFFIX\" value=\"\" \/>/g" src\plugins\contrib\help_plugin\help-plugin.cbp | sed "s/<Add option=\"-DwxUSE_UNICODE\" \/>$//g" > src\plugins\contrib\help_plugin\help-plugin-ansi.cbp
sed "s/<Variable name=\"WX_SUFFIX\" value=\"u\" \/>/<Variable name=\"WX_SUFFIX\" value=\"\" \/>/g" src\plugins\contrib\keybinder\keybinder.cbp | sed "s/<Add option=\"-DwxUSE_UNICODE\" \/>$//g" > src\plugins\contrib\keybinder\keybinder-ansi.cbp
sed "s/<Variable name=\"WX_SUFFIX\" value=\"u\" \/>/<Variable name=\"WX_SUFFIX\" value=\"\" \/>/g" src\plugins\contrib\lib_finder\lib_finder.cbp | sed "s/<Add option=\"-DwxUSE_UNICODE\" \/>$//g" > src\plugins\contrib\lib_finder\lib_finder-ansi.cbp
sed "s/<Variable name=\"WX_SUFFIX\" value=\"u\" \/>/<Variable name=\"WX_SUFFIX\" value=\"\" \/>/g" src\plugins\contrib\profiler\cbprofiler.cbp | sed "s/<Add option=\"-DwxUSE_UNICODE\" \/>$//g" > src\plugins\contrib\profiler\cbprofiler-ansi.cbp
sed "s/<Variable name=\"WX_SUFFIX\" value=\"u\" \/>/<Variable name=\"WX_SUFFIX\" value=\"\" \/>/g" src\plugins\contrib\source_exporter\Exporter.cbp | sed "s/<Add option=\"-DwxUSE_UNICODE\" \/>$//g" > src\plugins\contrib\source_exporter\Exporter-ansi.cbp
sed "s/<Variable name=\"WX_SUFFIX\" value=\"u\" \/>/<Variable name=\"WX_SUFFIX\" value=\"\" \/>/g" src\plugins\contrib\symtab\symtab.cbp | sed "s/<Add option=\"-DwxUSE_UNICODE\" \/>$//g" > src\plugins\contrib\symtab\symtab-ansi.cbp
sed "s/<Variable name=\"WX_SUFFIX\" value=\"u\" \/>/<Variable name=\"WX_SUFFIX\" value=\"\" \/>/g" src\plugins\contrib\regex_testbed\RegExTestbed.cbp | sed "s/<Add option=\"-DwxUSE_UNICODE\" \/>$//g" > src\plugins\contrib\regex_testbed\RegExTestbed-ansi.cbp
sed "s/<Variable name=\"WX_SUFFIX\" value=\"u\" \/>/<Variable name=\"WX_SUFFIX\" value=\"\" \/>/g" src\plugins\contrib\wxSmith\wxSmith.cbp | sed "s/<Add option=\"-DwxUSE_UNICODE\" \/>$//g" > src\plugins\contrib\wxSmith\wxSmith-ansi.cbp
sed "s/<Variable name=\"WX_SUFFIX\" value=\"u\" \/>/<Variable name=\"WX_SUFFIX\" value=\"\" \/>/g" src\tools\cb_share_config\cb_share_config.cbp | sed "s/<Add option=\"-DwxUSE_UNICODE\" \/>$//g" > src\tools\cb_share_config\cb_share_config-ansi.cbp
PAUSE
ContribPlugins-ansi.workspace
<CodeBlocks_workspace_file>
<Workspace title="All contrib plugins">
<Project filename="plugins\contrib\byogames\byogames-ansi.cbp" active="1" />
<Project filename="plugins\contrib\cb_koders\cb_koders-ansi.cbp" />
<Project filename="plugins\contrib\codesnippets\codesnippets-ansi.cbp" />
<Project filename="plugins\contrib\codestat\codestat-ansi.cbp" />
<Project filename="plugins\contrib\copystrings\copystrings-ansi.cbp" />
<Project filename="plugins\contrib\devpak_plugin\DevPakPlugin-ansi.cbp" />
<Project filename="plugins\contrib\dragscroll\dragscroll-ansi.cbp" />
<Project filename="plugins\contrib\envvars\envvars-ansi.cbp" />
<Project filename="plugins\contrib\help_plugin\help-plugin-ansi.cbp" />
<Project filename="plugins\contrib\keybinder\keybinder-ansi.cbp" />
<Project filename="plugins\contrib\lib_finder\lib_finder-ansi.cbp" />
<Project filename="plugins\contrib\profiler\cbprofiler-ansi.cbp" />
<Project filename="plugins\contrib\source_exporter\Exporter-ansi.cbp" />
<Project filename="plugins\contrib\symtab\symtab-ansi.cbp" />
<Project filename="plugins\contrib\regex_testbed\RegExTestbed-ansi.cbp" />
<Project filename="plugins\contrib\wxSmith\wxSmith-ansi.cbp" />
<Project filename="tools\cb_share_config\cb_share_config-ansi.cbp" />
</Workspace>
</CodeBlocks_workspace_file>
Tim S