Nov 4, 2009

Perl Error - Can't do inplace edit without backup.

Error :
Can't do inplace edit without backup.

Cause & Solution:
This is a perl one line command execution error.
You have to supply bakup filename if you want to edit the file in command line.
ex:
perl -i.bak -p -e 's/this/that/ig' *.txt


If you find this information helpful, please click the ads below

1 comment:

  1. if the following error occurs. You need to check if your script has a open handle on $fileName


    [ERROR]
    Can't do inplace edit on $fileName: File exists.

    This can happen in following program

    open(file,".\\test.txt");
    while(){
    print $_;
    }

    system("perl -pi\.bak -p -e \"s/LSSERVER=.*/LSSERVER=TRUE/g\" .\\test\.txt");

    ReplyDelete