Solved

UNIX sed

Posted on 2011-09-16
6
349 Views
Last Modified: 2012-05-12
I'd like to replace the word "Failed" in <TD>Failed</TD> with <TD><p style="background-color:red;">Failed</p></TD>

I used sed -e 's/Failed/<p style="background-color:red;">Failed<\/p>/
but it was errored out.
Please help.  Thanks.

Besides, can "sed" ignore the case?
0
Comment
Question by:scpig
  • 3
  • 2
6 Comments
 
LVL 21

Accepted Solution

by:
Papertrip earned 125 total points
Comment Utility
sed -e 's/Failed/\<p\ style=\"background-color:red\;\"\>Failed\<\/p\>/' filename

Open in new window

0
 

Author Comment

by:scpig
Comment Utility
Thanks. This works.  
But how do I ignore case (-i) in this sed?  The word could be "Failed", "failed", or "FAILED".
0
 
LVL 21

Expert Comment

by:Papertrip
Comment Utility
sed -e 's/Failed/\<p\ style=\"background-color:red\;\"\>Failed\<\/p\>/i' filename

Open in new window

0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Closing Comment

by:scpig
Comment Utility
works good.  Thank you.
0
 
LVL 48

Expert Comment

by:Tintin
Comment Utility
No need for the leaning toothpick syndrome ;-)


sed  's#Failed#<p style="background-color:red;">Failed</p>#i' filename

Open in new window

0
 
LVL 21

Expert Comment

by:Papertrip
Comment Utility
Learn something new every day, thanks Tintin.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
Utilizing an array to gracefully append to a list of EmailAddresses
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video discusses moving either the default database or any database to a new volume.

728 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

9 Experts available now in Live!

Get 1:1 Help Now