I have Cygwin installed, I want to execute something like this on the command prompt:
perl -pne 's/</<' input > output
But I’m running into two separate issues with the & and < each needing to be escaped.
- something like
's/&/&'is an error at the perl level- “Substitution pattern not terminated at -e line 1“
- something like
's/</<'is an error at the shell level- “The system cannot find the file specified.“
What do I have to do to fix this?
Seriously, if you have CygWin installed, you should be doing everything from
bash, notcmd.exe. It has much more capability when it comes to processing and escaping command line arguments.Having said that, you may try to use the
^escape character. That’s the standard one forcmd.exeand it may allow you to at least get rid of the problem with<:I haven’t tried this since I don’t have Perl installed on my local Windows VM. I do have CygWin on the laptop but, as I said, I tend to use
bashthere instead ofcmd.exe. So all care and no responsibility on this answer 🙂