IN PLACE edit syntax help needed

R

Randy Harris

I've tried every syntax combination that I can think of. Would someone
kindly tell me the correct syntax.

E:\Documents>perl -i -p -e s/(var showPartFileIcon)=true/$1=false/i rrh.html
Substitution pattern not terminated at -e line 1.

E:\Documents>perl -i -p -e 's/(var showPartFileIcon)=true/$1=false/i
rrh.html'
Can't find string terminator "'" anywhere before EOF at -e line 1.

E:\Documents>perl -i -p -e 's/(var showPartFileIcon)=true/$1=false/i'
rrh.html
Can't find string terminator "'" anywhere before EOF at -e line 1.

E:\Documents>perl -i -p -e 's/(var showPartFileIcon)=true/$1\=false/i'
'rrh.html'
Can't find string terminator "'" anywhere before EOF at -e line 1.

E:\Documents>perl -i -p -e 's/(var showPartFileIcon)\=true/$1\=false/i'
'rrh.html'
Can't find string terminator "'" anywhere before EOF at -e line 1.

E:\Documents>perl -i -p -e 's/(var showPartFileIcon)\=true/$1\=false/i;'
'rrh.html'
Can't find string terminator "'" anywhere before EOF at -e line 1.

E:\Documents>perl -i -p -e 's/(var showPartFileIcon)\=true/$1\=false/i'
'rrh.html;'
Can't find string terminator "'" anywhere before EOF at -e line 1.

Thanks in advance
 
S

Sam Holden

I've tried every syntax combination that I can think of. Would someone
kindly tell me the correct syntax.

E:\Documents>perl -i -p -e s/(var showPartFileIcon)=true/$1=false/i rrh.html
Substitution pattern not terminated at -e line 1.

perl -i -p -e "s/(var showPartFileIcon)=true/$1=false/i" rrh.html

I'm assuming that's a place holder argument of some sort, not much
point capturing a constant string (though I guess it saves some typing
and possible typos)...

[snip examples using ']

The dos/windows command shell uses double quotes not single quotes for
argument quoting. Under unix the above won't work since the $1 will be
interpreted as a shell variable.

Surely your Operating System came with some sort of documention?
 
J

Joe Smith

Randy said:
I've tried every syntax combination that I can think of. Would someone
kindly tell me the correct syntax.

E:\Documents>perl -i -p -e s/(var showPartFileIcon)=true/$1=false/i rrh.html
Substitution pattern not terminated at -e line 1.

C:\>perl -i.bak -p -e "s/(var showPartFileIcon)=true/$1=false/i" rrh.html

or, if you've installed a better command-line shell from www.cygwin.com,

C:\>\cygwin\cygwin.bat
$ perl -pi.bak -e 's/(var showPartFileIcon)=true/$1=false/i' rrh.html

-Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top