473,769 Members | 3,828 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

inplace edit error message

I'm working through the examples in Jeffrey E. F. Friedl's book 'Mastering
Regular Expressions, 2nd Ed.'. I'm trying to work the example at the top of
p. 53, but I'm attempting it in a command prompt window (I'm using Windows
2000 pro). I enter:
perl -p -i -e 's/sysread/read/g' substitute.txt

I get this error message:
"Can't do inplace edit without backup."

Any ideas?

Thanks,
Al
Jul 19 '05 #1
4 17543
In article <2E************ ******@nwrdny01 .gnilink.net>,
news.verizon.ne t <ac******@veriz on.net> wrote:
I'm working through the examples in Jeffrey E. F. Friedl's book 'Mastering
Regular Expressions, 2nd Ed.'. I'm trying to work the example at the top of
p. 53, but I'm attempting it in a command prompt window (I'm using Windows
2000 pro). I enter:
perl -p -i -e 's/sysread/read/g' substitute.txt

I get this error message:
"Can't do inplace edit without backup."

Any ideas?

Thanks,
Al


Your perl is not letting you overwrite the substitute.txt file. While I
am not sure why this is so, you should be able to get around this by
specifying an extension after the -i switch. Perl will then save the
original file with this extension and write the modified file to the
original file name (untested):

perl -p -i '.bak' -e 's/sysread/read/g' substitute.txt

FYI: the comp.lang.perl news group is obsolete. Try using
comp.lang.perl. misc in the future.
Jul 19 '05 #2
Jim,

TFYR. It ran without error this time and produced the backup file.
However, when I opened the substitute.txt file, it was unchanged. I
expected to see all occurrences of 'sysread' to be changed to 'read'. I'll
work on it some more. Thanks.
(And I'll be using the other newsgroup you mentioned).

Al
"Jim Gibson" <jg*****@mail.a rc.nasa.gov> wrote in message
news:2909200313 11419637%jg**** *@mail.arc.nasa .gov...
In article <2E************ ******@nwrdny01 .gnilink.net>,
news.verizon.ne t <ac******@veriz on.net> wrote:
I'm working through the examples in Jeffrey E. F. Friedl's book 'Mastering Regular Expressions, 2nd Ed.'. I'm trying to work the example at the top of p. 53, but I'm attempting it in a command prompt window (I'm using Windows 2000 pro). I enter:
perl -p -i -e 's/sysread/read/g' substitute.txt

I get this error message:
"Can't do inplace edit without backup."

Any ideas?

Thanks,
Al


Your perl is not letting you overwrite the substitute.txt file. While I
am not sure why this is so, you should be able to get around this by
specifying an extension after the -i switch. Perl will then save the
original file with this extension and write the modified file to the
original file name (untested):

perl -p -i '.bak' -e 's/sysread/read/g' substitute.txt

FYI: the comp.lang.perl news group is obsolete. Try using
comp.lang.perl. misc in the future.

Jul 19 '05 #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

"news.verizon.n et" <ac******@veriz on.net> wrote in
news:2E******** **********@nwrd ny01.gnilink.ne t:
I'm working through the examples in Jeffrey E. F. Friedl's book
'Mastering Regular Expressions, 2nd Ed.'. I'm trying to work the
example at the top of p. 53, but I'm attempting it in a command prompt
window (I'm using Windows 2000 pro). I enter:
perl -p -i -e 's/sysread/read/g' substitute.txt

I get this error message:
"Can't do inplace edit without backup."


I have seen this under Windows, since the Windows OS filesystem does not
have Unix's flexibility when it comes to editing a file in-place.

You'll have to specify a backup file extension with the -i option.

For your future reference, comp.lang.perl is a defunct newsgroup. General
Perl questions should be posted to comp.lang.perl. misc; you'll get a better
response there.

- --
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP3q77mPeouI eTNHoEQIpvQCg9s k+wQ994dpbqRFJB tSh1ROLtOYAn2ZY
65N1CH3bU8n8T6X DVfd5LckO
=coZf
-----END PGP SIGNATURE-----
Jul 19 '05 #4
In article <2E************ ******@nwrdny01 .gnilink.net>,
news.verizon.ne t <ac******@veriz on.net> wrote:
I'm working through the examples in Jeffrey E. F. Friedl's book 'Mastering
Regular Expressions, 2nd Ed.'. I'm trying to work the example at the top of
p. 53, but I'm attempting it in a command prompt window (I'm using Windows
2000 pro). I enter:
perl -p -i -e 's/sysread/read/g' substitute.txt

I get this error message:
"Can't do inplace edit without backup."

Any ideas?

Thanks,
Al


You need to specify a file extension after the -i option so that perl
has someplace to put the original file:

perl -p -i '.bak' -e 's/sysread/read/g' substitute.txt

This newsgroup is defunct. Try comp.lang.perl. misc in the future.
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5307
by: Anna Hutter | last post by:
Hello, this question is about DB2 UDB V8 and its inplace reorganisation. It seems that in small tables, an inplace reorg doesn´t start. Is there a limit in size of a table when a reorg starts? How can I be sure that a reorg has successfully finished? I found three methods to watch if an asynchronous reorg has finished: a) db2 "select * from table(sysproc.snapshot_tbreorg('reo_test',0)) as t"
25
10420
by: dixie | last post by:
I have some code that adds new records into a table for each ID in a list box when a button on a form is clicked. This works fine. My problem now is that I wish to be able to edit all the records for people whose ID is in the list box. I made minor changes to the code (mainly replacing rs.AddNew with rs.Edit)and it appears to be updating only the first record and then overwriting that record with the next, etc until it runs out of ID's...
0
1032
by: jason | last post by:
hi, I have a datagrid in my input form. Using datagrid inplace editing to save data (chinese characters) entered by user. It works as expected on my test record. But, when i started to enter new record, the datagrid textbox.text shows "??" instead of the chinese character.
2
6135
by: aj | last post by:
DB2 LUW v8.2 FP 14 RHAS 2.1 I'm confused about the NOTRUNCATE TABLE option of the REORG TABLE INPLACE command. In my mind, truncating the table means that you delete all rows that it has - why would you not use this option as part of the reorg? If you want to truncate, why not just delete the table and recreate it w/ DDL? I deleted a great many rows from a wide table yesterday, then did an online/inplace REORG against it, using the...
0
2194
by: Roger | last post by:
I changed my classic reorgs to inplace reorg on my siebel database last weekend and ran into the log space getting full issue . This is one of the command on my script : reorg table SIEBEL.ASSET index SIEBEL.XASSET1 inplace; I have two questions : 1. On the classic reorg, i know the indexes get rebuild. When I issue the above command, will any of the indexes get rebuild ? If none of
1
19980
by: varsha21 | last post by:
Hi, I am writing a command line perl program to convert a file in dos format to unix format. I know that the following instruction executes successfully on one of the unix machine. I am trying to execute it through cygwin. perl -pi -e 's/\r\n/\n/;' InputAndOutputFile.sh But I get following error. Can't do inplace edit without backup
1
1645
by: Matt Herzog | last post by:
Hey All. I'm learning some python with the seemingly simple task of updating a firewall config file with the new IP address when my dhcpd server hands one out. Yeah, I know it's dangerous to edit such a file "in place" but this is just an exercise at this point. I would not mind using file handles except they seem to add complexity. The only apparent problem I have with my script so far is that it's adding lots of blank lines to the file...
0
1255
by: Gabriel Genellina | last post by:
En Thu, 08 May 2008 09:11:56 -0300, Michael Mabin <d3vvnull@gmail.comescribió: Like this? <code> import sys,fileinput for line in fileinput.input(inplace=True): sys.stdout.write(line.replace('mike','dave'))
0
2088
by: mvsmsh | last post by:
Hi listers , Has anyone met REORG INPLACE error -964 " The transaction log for the database is full " ? I wonder , why REORG INPLACE error -964 even if archive successful ? We're using archive log with TSM userexit and plenty of space available on the log file system for the new log , it looks like REORG use all the primary , secondary logs. ( It happened couple of
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9420
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10205
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10035
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9851
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8863
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7401
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3556
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.