Help with Perl Regex Recursive Replace One Liner? Replace MySQL comments '--' with '#'
Posted
by NJTechie
on Stack Overflow
See other posts from Stack Overflow
or by NJTechie
Published on 2010-04-29T21:19:26Z
Indexed on
2010/04/29
21:27 UTC
Read the original article
Hit count: 295
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.
© Stack Overflow or respective owner