[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

how do I remove this string

Posted on 2006-07-22
4
Medium Priority
?
163 Views
Last Modified: 2010-03-05
Hi Everyone.
I am having trouble figuring out how to remove a string from a text file.  If someone could help I would really appreciate it.  Below is a css that I have and I need to remove the "position:relative" from each of the "a" tags and leave the rest alone.

input {
      position:relative;
}

iframe {
      position:relative;
}
button {
      position:relative;
}

a { color: white;
      font-size: 12px;
      font-weight: bold;
      text-decoration: none;
      position:relative;
}

a:hover { color: silver !important;
      font-size: 12px;
      font-weight: bold;
      text-decoration: none;
      position:relative;
}
a.category {
      font-family: Verdana, Arial, Helvetica, sans-serif;
      color: silver;
      font-size: 16px;
      font-weight: bold;
      position:relative;
}

a.category:hover {
      color: #8e8e8e !important;
      font-family: Verdana, Arial, Helvetica, sans-serif;
      font-size: 16px;
      font-weight: bold;
      position:relative;
}

I'm in a hurry for this so I am giving maximum points.
Thanks
0
Comment
Question by:kareed
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 17161984
perl -i.bak -0175 -pe "s/\s*position:relative;.*// if /^\s*a\b/" filename
0
 

Author Comment

by:kareed
ID: 17162101
Hi ozo,
Thanks for the response.  I am trying to modify a string that I already have loaded and done a few other things to.  I also need the "position:relative;" replaced on each of the tags related to "a" such as "a.category:hover", "a.category", "a:hover".  One problem I have is they may or may not be there or there may be new ones.  I just need to make sure that all "position:relative;" with a preceeding "a" gets removed.  Now since I have a terrible time figuring out regexp's, will what you gave me handle this?

my $style = "...the text listed above..."

Thanks again.
0
 
LVL 84

Accepted Solution

by:
ozo earned 2000 total points
ID: 17162193
$style =~ s/(\ba\b[^{]*{[^{]*)\s*position:relative;/$1/g;
0
 

Author Comment

by:kareed
ID: 17162232
Thanks ozo, it worked perfectly.  I really appreciate it.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

649 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