Re: Bold text
by gothic_mallard (Pilgrim) on Jan 10, 2005 at 14:11 UTC
|
In a simple text file no.
A plain text file contains no information about formatting or style beyond (essentially) spaces, tabs and newlines.
This isn't really a perl question.
--- Jay
All code is untested unless otherwise stated.
All opinions expressed are my own and are intended as guidance, not gospel; please treat what I say as such and as Abigail said Think for yourself.
If in doubt ask.
s++blah+;y(bl) .j.s;s+(h)+p$1+;???print:??;
| [reply] [d/l] |
A reply falls below the community's threshold of quality. You may see it by logging in. |
Re: Bold text
by Fletch (Bishop) on Jan 10, 2005 at 14:08 UTC
|
Yes. Just print it out and pull out a pen and go over what you want in bold. If you really want to be neat use a ruler to do the underlines.
(Gah, this is so vague it's going to start sucking in context from other questions)
| [reply] |
Re: Bold text (man)
by tye (Sage) on Jan 10, 2005 at 17:13 UTC
|
"man" likes to do underscoring and bolding in a way that works when you print (well, on some printers, anyway) the file and is mostly ignored when you display it on the screen. This is so common that pagers like "more" are likely to notice it and make it work on the screen as well.
The trick is to use backspace or carriage return to put multiple characters in the same spot. So you'd write "_\b3" ("\b" is backspace) to have "3" underlined and you'd write "3\b3" to have "3" bold and "_\b3\b3" to have it bold and underscored. Dealing with multi-char sequences is slightly trickier but still pretty easy in Perl.
Note that "\b" won't work in anything I can think of other than Perl. So if this wasn't a Perl question, you'll need to look up how to write backspace or carriage return in what you are using.
There are also nodes here (see Super Search) that describe how to transform such overlapping text into other formats...
| [reply] |
Re: Bold text
by ZlR (Chaplain) on Jan 10, 2005 at 15:50 UTC
|
| [reply] |
|
|
| [reply] [d/l] |
Re: Bold text
by kutsu (Priest) on Jan 10, 2005 at 16:25 UTC
|
Others have already answered your question, but in case you mean something besides "simple text file" when you say "simple text file". What I mean by that is a simple text file is usually just that "simple text" however a document file (or a Rich Text Format, RTF, file) can create bold, italic, or underlined text - this would have to be done through some software's API though that might be possible with perl. I've used OpenOffice::OODoc without problem or search cpan yourself for Microsoft Office or RTF or etc...
This is a very simplified explaination, but I felt doc and rtf types of files should be mentioned
"Cogito cogito ergo cogito sum - I think that I think, therefore I think that I am." Ambrose Bierce
| [reply] |
Re: Bold text
by EdwardG (Vicar) on Jan 10, 2005 at 16:53 UTC
|
$text_to_emphasise =~ s/(\d+)/_*\1*_/g;
| [reply] [d/l] |
|
|
You ought to be using $1 in the replacement, not \1. -w would have told you.
| [reply] |
|
|
| [reply] |