Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > IN PLACE edit syntax help needed

Reply
Thread Tools

IN PLACE edit syntax help needed

 
 
Randy Harris
Guest
Posts: n/a
 
      02-23-2004
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


 
Reply With Quote
 
 
 
 
Sam Holden
Guest
Posts: n/a
 
      02-23-2004
On Mon, 23 Feb 2004 04:32:00 GMT, Randy Harris <(E-Mail Removed)> wrote:
> 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?

--
Sam Holden
 
Reply With Quote
 
 
 
 
Joe Smith
Guest
Posts: n/a
 
      02-25-2004
Randy Harris wrote:

> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Edit file in place using perl script khan Perl Misc 7 10-20-2008 02:29 PM
[Q] In place edit mode activation? Laurent Julliard Ruby 1 07-10-2008 05:58 AM
Gridview placed in edit mode jumps and loses place dba56 ASP .Net 0 07-07-2006 08:55 PM
Snapshot restraint - edit, edit, edit Alan Browne Digital Photography 24 05-10-2005 10:15 PM
Snapshot restraint - edit, edit, edit Patrick Digital Photography 0 05-06-2005 10:53 PM



Advertisments