Solved

<a href

Posted on 2002-07-15
6
250 Views
Last Modified: 2013-12-25
I've got a html file which contains lines with <a href="blablabla">interesting text</a>

How can I open this html file and delete all occurences of <a href="bliblibli"> and </a>

"blablabla and bliblibli are just examples, it are random words.
0
Comment
Question by:oostwijk
6 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 7156391
perl -i.bak -pe "s#</?a\b[^>]*># #gi;" file
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7156804
still hac been answered in http://www.experts-exchange.com/perl/Q_20323316.html
Ask support at EE to delete this question.
0
 

Author Comment

by:oostwijk
ID: 7158112
i posted this question before in the perl section, but it was ment to be a cgi question.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 5

Accepted Solution

by:
Peewee earned 50 total points
ID: 7159085
oostwijk,

if you need to do this within your code a good way to do this as follows:

#!/usr/bin/perl
#
#####################################
# Code by Peewee              #
#                        #
#####################################
#

use CGI;
use CGI::Carp qw(fatalsToBrowser);
use strict;

my $doc                    =     shift;
my $html_page;

### main processing is encapsulated here

open (PAGE, "<$doc") || die "unable to open $doc";  
while (<PAGE>) {

     $html_page     .= $_;
}
close PAGE;

$html_page     =~ s/<a href=".*">.*<\/a>/link/ig;


print qq~
$html_page
~;


Note that that to print this to the browser you will need a print "Content-type: text\html \n\n";

regards Peewee
0
 
LVL 5

Expert Comment

by:Peewee
ID: 7164432
oostwijk,
did you get the sloution u were looking for?

regards Peewee
0
 

Author Comment

by:oostwijk
ID: 7168649
sorry, for my late responce... This works fine.
Thanks m8
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now