LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-28-2011, 06:31 AM   #1
felix001
Member
 
Registered: Jan 2009
Posts: 101

Rep: Reputation: 15
Sed Question


I currently have html code which I want to remove all
  1. <p> after any <blockquote>
  2. </p> before any </blockquote>

Below is an example of some of the html.

Code:
6. Under the global_policy map,&nbsp; assign the http inspection policy map against the match class map (class-http-match1) .
<blockquote>
<p>&nbsp;&nbsp;&nbsp; policy-map global_policy<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; class class-http-match1<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inspect http policy-http1</p>
</blockquote>
<p>7. Assign global_policy to all interfaces.</p>
<blockquote>
<p>&nbsp;&nbsp;&nbsp; service-policy global_policy global</p>
</blockquote>
Ive tried using the following without success..

Code:
sed  "s/<blockquote>'\n'/<blockquote>/g" inputhtml.txt
 
Old 02-28-2011, 06:40 AM   #2
kurumi
Member
 
Registered: Apr 2010
Posts: 228

Rep: Reputation: 53
Code:
$ cat file
6. Under the global_policy map,&nbsp; assign the http inspection policy map against the match class map (class-http-match1) .
<blockquote>
<p>&nbsp;&nbsp;&nbsp; policy-map global_policy<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; class class-http-match1<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inspect http policy-http1</p>
</blockquote>
<p>7. Assign global_policy to all interfaces.</p>
<blockquote>
<p>&nbsp;&nbsp;&nbsp; service-policy global_policy global</p> test <p>&nbsp;&nbsp;&nbsp; service-policy global_policy global</p>
</blockquote>

$ ruby -0777 -ne 'puts $_.split(/<\/blockquote>/).each {|x| x.gsub!(/<p>.*?<\/p>/,"")}.join("</blockquote>")' file
6. Under the global_policy map,&nbsp; assign the http inspection policy map against the match class map (class-http-match1) .
<blockquote>

</blockquote>

<blockquote>
 test
</blockquote>
 
Old 02-28-2011, 06:54 AM   #3
felix001
Member
 
Registered: Jan 2009
Posts: 101

Original Poster
Rep: Reputation: 15
Thanks but i was hoping for a method using sed.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] another sed question (sorry) gary_in_springhill Programming 9 01-03-2011 05:46 PM
sed Question unihiekka Linux - Newbie 3 09-25-2009 12:08 PM
sed question? slack66 Linux - Newbie 7 07-26-2006 06:47 AM
[sed] "Advanced" sed question(s) G00fy Programming 2 03-20-2006 12:34 AM
little sed question freelinuxcpp Linux - Software 3 01-20-2004 07:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:52 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
Open Source Consulting | Domain Registration