L
laredotornado
Hi,
I'm using Perl 5.12.3 on Mac 10.7.4. I have a file with lines that look like
AK=Alaska
AL-Alabama
....
and when I run this search and replace expression
perl -pi -e "s/(..)=(.*)/INSERT INTO cb_states (ABBREV, NAME) VALUES ('$1', '$2');/g" states.properties
The values of "$1" and "$2" result in empty strings in my file. That is, the output in the file is
INSERT INTO cb_states (ABBREV, NAME) VALUES ('', '');
INSERT INTO cb_states (ABBREV, NAME) VALUES ('', '');
What is the correct way to write the command line expression above to properly insert the matched values? Thanks,- Dave
I'm using Perl 5.12.3 on Mac 10.7.4. I have a file with lines that look like
AK=Alaska
AL-Alabama
....
and when I run this search and replace expression
perl -pi -e "s/(..)=(.*)/INSERT INTO cb_states (ABBREV, NAME) VALUES ('$1', '$2');/g" states.properties
The values of "$1" and "$2" result in empty strings in my file. That is, the output in the file is
INSERT INTO cb_states (ABBREV, NAME) VALUES ('', '');
INSERT INTO cb_states (ABBREV, NAME) VALUES ('', '');
What is the correct way to write the command line expression above to properly insert the matched values? Thanks,- Dave