LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-24-2007, 03:49 PM   #1
NiallC
Member
 
Registered: Feb 2003
Distribution: Suse 8.1
Posts: 102

Rep: Reputation: 15
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
 
Old 08-24-2007, 04:04 PM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
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!

Last edited by Nylex; 08-24-2007 at 04:06 PM.
 
Old 08-25-2007, 11:32 AM   #3
NiallC
Member
 
Registered: Feb 2003
Distribution: Suse 8.1
Posts: 102

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Nylex View Post
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
No bold fonts on firefox 1.5.0.1 mushk45 Linux - Software 2 03-13-2006 11:09 AM
How do I xemacs bold? wmcase Linux - Software 2 05-26-2005 03:15 PM
Search and Replace: Asian Words to English Words ieeestd802 Linux - Software 0 10-27-2004 07:48 PM
how do bold and italic in vim? lugoteehalt Linux - Newbie 3 04-19-2004 07:17 AM
bold Font in Bash Or C AMMullan Programming 5 09-24-2003 04:26 PM


All times are GMT -5. The time now is 12:26 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration