in reply to Re^2: perl one liner to replace matching string
in thread perl one liner to replace matching string
Ok, I get the same result as you reported. Playing around with it, I had to add two additional backslashes to get it to work as desired (not sure why):
my $ext='c'; qx("perl -p -i.bak -e \"s/(\\\@Filetyp\\s*?:)/\\1$ext/\" ./path/test.c +"); # ^^
(Note: I also had to specify an extension for the backup file.) This is on Windows; if your O/S is different, it may treat the backslashes differently.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: perl one liner to replace matching string
by Veltro (Hermit) on Jun 10, 2018 at 20:06 UTC | |
|
Re^4: perl one liner to replace matching string
by vinoth.ree (Monsignor) on Jun 10, 2018 at 16:58 UTC | |
by AnomalousMonk (Archbishop) on Jun 10, 2018 at 18:44 UTC |