To port a GNU makefile to the (non-cygwin) win32 platform, I am looking for a way to scan source files for the patterns such as '1234 // $RESOURCE$ "my_image.ico"', to then be appended to a resource file in the format '1234 ICON "my_image.ico"'. Using perl this is can be accomplished as such:
perl -nle 'print "$1 ICON $2" if /([0-9]+)\s*\/\/\s*\$RESOURCE\$\s*(\".*\")\s*$$/'
On windows, the thing that just came close is findstr
, but this only allows for matching, not outputting in the alternative form. Simply replacing the string constant in between should do it I guess.
Any clues on how to get this going, short of including my own perl/sed.exe in the distribution :)?