LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-28-2010, 12:49 PM   #1
gotisf
LQ Newbie
 
Registered: Jun 2010
Posts: 2

Rep: Reputation: 0
Editing multiple files


Hi.
I have a directory with hundreds of html files.
For all the files I have to:
- delete all the row from the beginning of the file to the sentence "<img src="immagini/_navDxBottom.gif" />".

- delete all the rows from the sentence "<br clear="right" />" to the end of the file.

How can I do that?
Thank you very much.
Giovanni.
 
Old 06-28-2010, 01:20 PM   #2
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 164Reputation: 164
The easiest way to do those operations would either be a perl script or an awk script. I imagine if you're unfamiliar with both the awk would take less time to get right.
 
Old 06-28-2010, 02:08 PM   #3
gotisf
LQ Newbie
 
Registered: Jun 2010
Posts: 2

Original Poster
Rep: Reputation: 0
I don't know nothing about awk and sed, can you please give me a help?
 
Old 06-28-2010, 03:15 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Here's one of the favorite tutorials on SED:

http://www.grymoire.com/Unix/Sed.html

(The same site also has a good AWK tutorial.)

Look at the section on address ranges. For example, suppose you wanted to delete all lines, starting with a line containing "tweedledee" and ending with a line containing "tweedledum". The code would be:

sed '/tweedledee/,/tweedledum/d' filename > newfilename
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Editing grub for multiple OSes raci1983 Linux - Software 5 04-29-2010 05:30 AM
[SOLVED] Vim help,editing multiple files cola Linux - Newbie 5 03-28-2010 12:01 AM
editing multiple html files at once phantom_cyph Linux - Software 11 02-27-2008 11:08 PM
editing multiple files in linux? vinoj Programming 4 11-02-2004 02:31 AM
batch editing multiple lines statmobile Programming 8 09-16-2004 08:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration