Following may help you in same, if your all input data is in same provided form as per your shown input.
Output will be as follows. EDIT: Added a non one liner form of solution on same.
Thanks,
R. Singh
Last edited by RavinderSingh13; 02-20-2015 at 09:09 AM..
Reason: Added a non oneliner form of solution
This User Gave Thanks to RavinderSingh13 For This Post:
Hi,
I am trying to strip html tags of a string for example
<TD>no problem</TD>
the sesult should be
no problem
but could never get rid off all the tags
sed 's/<..D>//g'
Please help, I am new (3 Replies)
I am cleaning up HTML with sed. With the regexp
<a name="+"></a><h>*<span class="mw-headline" >+</span></h>
I can find the tags I need. But when I place them in a sed command, sed fails. So I started building up from a smaller command. This is where I am now:
sed -r -e s/"<a... (3 Replies)
Hello,
I am using sed as follows -
sed 's/CONTACT SYSTEMS! Some payments have been rejected/<B><font color="red" size="5.0pt"CONTACT SYSTEMS! Some payments have been rejected</font></B>/' $REPORT_FILE
But while executing this, I am getting the error as -
sed: command garbled
&... (5 Replies)
Hi, I am working on transforming html code text into the .vert text format. I want to use linux utility sed. I have this regexp which should do the work: s/ \(?!*>\)/\n/g. I use it like this with sed: echo "you <we try> there" | sed 's/ \(?!*>\)/\n/g' ... The demanded output should be:
you
<we... (5 Replies)
How to use sed to remove html tags including text between them?
Example: User <b> rolvak </b> is stupid. It does not using <b>OOP</b>!
and should output: User is stupid. It does not using !
Thank you.. (2 Replies)
I've got a text file which has " marks where it there should be ' marks. I tried to do it with sed, but it won't allow me to escape the ' mark.
Here's what I tried to do:
sed 's/"/\\'/g' file.txt
How can this be done?
Thanks (3 Replies)
I have pasted the contents of a log file (swmbackup.wrkstn.1262071383.sales2a) below:
Workstation: sales2a<BR
Vault sales2a-hogwarts will be initialized.<BR
<font color="red"There was a problem mounting /mnt/sales2a/desktop$ </FONT<BR
<font color="red"There was a problem mounting... (4 Replies)
Hi
I've searched for it for few hours now and i can't seem to find anything working like i want. I've got webpage, saved in file par with form like this:
<html><body><form name='sendme' action='http://example.com/' method='POST'>
<textarea name='1st'>abc123def678</textarea>
<textarea... (9 Replies)
Ok, so this is stupid simple, and I know I am going to feel like an idiot when I get help.
I am altering a HTML report that has contraband in it so that the links to said contraband and the images are not shown.
The link/img pairs are in the form of :
<a... (5 Replies)
Hi,
im trying to read a Temperature value from html code.
So far i have managed to reduce the whole html page down to this single line with the following sed command:sed -n '/Temperature/p' $temp_temperature | tee temp_string
<TD width='350'>Temperature :</td><td>25... (2 Replies)
Discussion started by: naittis
2 Replies
LEARN ABOUT DEBIAN
html::strip
Strip(3pm) User Contributed Perl Documentation Strip(3pm)NAME
HTML::Strip - Perl extension for stripping HTML markup from text.
SYNOPSIS
use HTML::Strip;
my $hs = HTML::Strip->new();
my $clean_text = $hs->parse( $raw_html );
$hs->eof;
DESCRIPTION
This module simply strips HTML-like markup from text in a very quick and brutal manner. It could quite easily be used to strip XML or SGML
from text as well; but removing HTML markup is a much more common problem, hence this module lives in the HTML:: namespace.
It is written in XS, and thus about five times quicker than using regular expressions for the same task.
It does not do any syntax checking (if you want that, use HTML::Parser), instead it merely applies the following rules:
1. Anything that looks like a tag, or group of tags will be replaced with a single space character. Tags are considered to be anything
that starts with a "<" and ends with a ">"; with the caveat that a ">" character may appear in either of the following without ending
the tag:
Quote
Quotes are considered to start with either a "'" or a """ character, and end with a matching character not preceded by an even
number or escaping slashes (i.e. """ does not end the quote but "\\"" does).
Comment
If the tag starts with an exclamation mark, it is assumed to be a declaration or a comment. Within such tags, ">" characters do not
end the tag if they appear within pairs of double dashes (e.g. "<!-- <a href="old.htm">old page</a> -->" would be stripped
completely).
2. Anything the appears within so-called strip tags is stripped as well. By default, these tags are "title", "script", "style" and
"applet".
HTML::Strip maintains state between calls, so you can parse a document in chunks should you wish. If one chunk ends half-way through a tag,
quote, comment, or whatever; it will remember this, and expect the next call to parse to start with the remains of said tag.
If this is not going to be the case, be sure to call $hs->eof() between calls to $hs->parse().
METHODS
new()
Constructor. Can optionally take a hash of settings (with keys corresponsing to the "set_" methods below).
For example, the following is a valid constructor:
my $hs = HTML::Strip->new(
striptags => [ 'script', 'iframe' ],
emit_spaces => 0
);
parse()
Takes a string as an argument, returns it stripped of HTML.
eof()
Resets the current state information, ready to parse a new block of HTML.
clear_striptags()
Clears the current set of strip tags.
add_striptag()
Adds the string passed as an argument to the current set of strip tags.
set_striptags()
Takes a reference to an array of strings, which replace the current set of strip tags.
set_emit_spaces()
Takes a boolean value. If set to false, HTML::Strip will not attempt any conversion of tags into spaces. Set to true by default.
set_decode_entities()
Takes a boolean value. If set to false, HTML::Strip will decode HTML entities. Set to true by default.
LIMITATIONS
Whitespace
Despite only outputting one space character per group of tags, and avoiding doing so when tags are bordered by spaces or the start or
end of strings, HTML::Strip can often output more than desired; such as with the following HTML:
<h1> HTML::Strip </h1> <p> <em> <strong> fast, and brutal </strong> </em> </p>
Which gives the following output:
" HTML::Strip fast, and brutal "
Thus, you may want to post-filter the output of HTML::Strip to remove excess whitespace (for example, using "tr/ / /s;"). (This has
been improved since previous releases, but is still an issue)
HTML Entities
HTML::Strip will only attempt decoding of HTML entities if HTML::Entities is installed.
EXPORT
None by default.
AUTHOR
Alex Bowley <kilinrax@cpan.org>
SEE ALSO
perl, HTML::Parser, HTML::Entities
perl v5.14.2 2011-11-15 Strip(3pm)