LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   How to bold words (http://www.linuxquestions.org/questions/programming-9/how-to-bold-words-579573/)

NiallC 08-24-2007 03:49 PM

How to bold words
 
Hello,

I have a large text file that has text in the following format:


Case 12345: The rain in span falls mainly


In the plain
Case 12345: The rain is still falling mainly


In the plain
Case 12345: The rain has fallen mainly


In the plain


and so on for the rest of the file . I'd like to convert the Case 123456: to bold.

I tried saving it as an HTML file and then running:

sed 's/Case 123456/<strong>Case 123456</strong>/g'

But it balked.

Ideally I'd like to insert a carriage return before every "Case..." also, but I'd be happy with just it being bolded...


Anyone have any ideas what's wrong with my command? Or is there a better way?

TIA

NiallC

Nylex 08-24-2007 04:04 PM

sed -i 's/stuff/\<strong>stuff\<\/strong>/g' file

seems to work. I know next to nothing about sed, but it seems you need to escape the angle brackets and the slashes!

NiallC 08-25-2007 11:32 AM

Quote:

Originally Posted by Nylex (Post 2869590)
sed -i 's/stuff/\<strong>stuff\<\/strong>/g' file

seems to work. I know next to nothing about sed, but it seems you need to escape the angle brackets and the slashes!

Actually, that didn't work on my file, but thanks for trying.

Although it seems like blasphemy, Microsoft Word did the trick in three mouse clicks.

Sorry to waste board space...

Niallc


All times are GMT -5. The time now is 12:18 PM.