473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Delete a line from the fil

123 100+
hi all

i have a directory in which there are numbers of files.
Each file contains the following code at the end

Expand|Select|Wrap|Line Numbers
  1.  
  2. <p align="right"><input name="closeme" type="button" value="Close Window" onclick="self.close()" /></p>
  3.  
i want to remove that code from all the files in the directory

I have tried out

Expand|Select|Wrap|Line Numbers
  1.  perl -pi -e 's/<p align="right"><input name="closeme" type="button" value="Close Window" onclick="self.close()" \/><\/p> /           /gi'  .*php 
  2.  
but it's not working..is there any other way to do so..
I have tried out sed command also
sed 'N;$;$;$d' filename but still not working..
Apr 28 '08 #1
2 1136
KevinADC
4,059 Expert 2GB
hi all

i have a directory in which there are numbers of files.
Each file contains the following code at the end

[code ]
<p align="right"><input name="closeme" type="button" value="Close Window" onclick="self.close()" /></p>
[/code]

i want to remove that code from all the files in the directory

I have tried out

Expand|Select|Wrap|Line Numbers
  1.  perl -pi -e 's/<p align="right"><input name="closeme" type="button" value="Close Window" onclick="self.close()" \/><\/p> /           /gi'  .*php 
  2.  
but it's not working..is there any other way to do so..
I have tried out sed command also
sed 'N;$;$;$d' filename but still not working..

Try:

Expand|Select|Wrap|Line Numbers
  1.  perl -pi -e 's/<p align="right"><input name="closeme" type="button" value="Close Window" onclick="self.close\(\)" \/><\/p> /           /gi'  .*php 
  2.  
The parenthesis should be escaped \(\) otherwise perl will see them as capturing brackets and not literal parenthesis. I'm not sure if perl expands .*php into a list of files to edit. Hopefully it does.
Apr 28 '08 #2
ajd335
123 100+
Try:

Expand|Select|Wrap|Line Numbers
  1.  perl -pi -e 's/<p align="right"><input name="closeme" type="button" value="Close Window" onclick="self.close\(\)" \/><\/p> /           /gi'  .*php 
  2.  
The parenthesis should be escaped \(\) otherwise perl will see them as capturing brackets and not literal parenthesis. I'm not sure if perl expands .*php into a list of files to edit. Hopefully it does.

Thanks Kevin..
IT's working
Apr 29 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: | last post by:
Hi all, I've been using C++ for quite a while now and I've come to the point where I need to overload new and delete inorder to track memory and probably some profiling stuff too. I know that...
6
by: I am Sam | last post by:
I keep getting this error and I don't know why: The path is too long after being fully qualified. Make sure path is less than 260 characters. Description: An unhandled exception occurred...
3
by: silver360 | last post by:
Hello, I'm trying to create a basic Heap manager and i have some question about new/delete overloading. The following code give me this output : >> $./heap >> registered : 0x804d098 >>...
9
by: groleo | last post by:
Hi list. Simple question: is it possible to override the global new/delete operators, without using malloc/free? I mean something in the ideea of the code below, which doesnt work cause of...
10
by: R.A.M. | last post by:
Hello, I am trying to learn SQL Server. I need to write a trigger which deletes positions of the document depending on the movement type. Here's my code: set ANSI_NULLS ON set...
5
by: rn5a | last post by:
The .NET 2.0 documentation states the following: When using a DataSet or DataTable in conjunction with a DataAdapter & a relational data source, use the Delete method of the DataRow to remove...
3
by: Kevin M | last post by:
I have one table and have created a form from that table. Also, I have created a delete query. I want to but a button on the form which will delete all records from the table; however, I cannot get...
4
by: jeepers | last post by:
Hi all, my problem is delete a line in a text file. the file contain -n line with user, userCode. i want to replace the line with user is egual at user, and/or insert new line but delete the...
24
by: biganthony via AccessMonster.com | last post by:
Hi, I have the following code to select a folder and then delete it. I keep getting a Path/File error on the line that deletes the actual folder. The line before that line deletes the files in...
2
by: Francesco Pietra | last post by:
Please, how to adapt the following script (to delete blank lines) to delete lines containing a specific word, or words? f=open("output.pdb", "r") for line in f: line=line.rstrip() if line:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...

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.