Help with Perl Regex Recursive Replace One Liner? Replace MySQL comments '--' with '#'
- by NJTechie
I have various SQL files with '--' comments and we migrated to the latest version of MySQL and it hates these comments. I want to replace -- with #.
I am looking for a recursive, inplace replace one-liner.
This is what I have : perl -p -i -e 's/--/# /g' `fgrep -- -- * `
A sample .sql file :
use myDB;
--did you get an error
I get the following error : Unrecognized switch: --did (-h will show valid options).
p.s : fgrep skipping 2 dashes was just discussed here if you are interested.
Any help is appreciated.