Modify Output Text Before Doing A Greg

liunx

Guest
Here's a simplified version of what I'm doing:<br /><br /># echo "<HTML>Testing</HTML>" | fgrep -i testing<br /><HTML>Testing</HTML><br /><br />No problems, it's working great. But I have a<br />need to remove any special formatting or junk<br />that may be included in that text.<br /><br />For instance, my script fails on this kind of grep:<br /><br /># echo "<HTML><B>Test</B>ing</HTML>" | fgrep -i testing<br /># <br /><br />Is there some sed/awk method of removing any<br /><any character in here> from a line before I try<br />to do my greps? I desire to grep data, not HTML.<br /><br />I'm no sed/awk expect, so I'm curious what to do!<br />Any help is clearly appreciated. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /><!--content-->
<!--fonto:courier--><span style="font-family:courier"><!--/fonto--><!--coloro:red--><span style="color:red"><!--/coloro-->sed -e 's/<[^>]*>//g'<!--colorc--></span><!--/colorc--><!--fontc--></span><!--/fontc--> should remove all HTML tags.<br /><br />For example:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->$ echo "<HTML><B>Test</B>ing</HTML>" | sed -e 's/<[^>]*>//g'                  <br />Testing<!--c2--></div><!--ec2--><br /><br />So in your example above, you can add grep on the end:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->echo "<HTML><B>Test</B>ing</HTML>" | sed -e 's/<[^>]*>//g' | fgrep -i testing<!--c2--></div><!--ec2--><!--content-->
Awesome, that should work perfect, thanks!<!--content-->
 
Back
Top