06-14-2016
What RudiC is trying to tell you is: your output file is written the way you anticipate it, with as many spaces as you have put into the double-quoted strings and all. But you are writing HTML-code and you probably look at the file not using a text editor but a web browser. This browser is eating your spaces away, because in HTML consecutive space characters are collapsed into one.
Use the <pre>....</pre>-tags RudiC mentioned, use the HTML code (non-breakable space) instead of literal space-chars or use a so-called "blind table" as a formatting device: create a (invisible) table where the columns are aligned at precisely the place where you need your text to start. Then you place the text in a cell in the the respective column to put i into a certain place.
I hope this helps.
bakunin
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
can any help how to remove blank spaces in a string?
STR="GOOD BYE"
by removing blank spaces, the string should be GOOD,BYE
thanks in advance (2 Replies)
Discussion started by: spandu
2 Replies
2. Shell Programming and Scripting
Folks, I am wondering if anyone solve this problem.
What I want to know is,
1. Delete all white spaces including leading blank space in each line (e.g. line 2), and replace such spaces by single tab except leading blank space
2. Then, align all columns to the right. But, output white space... (1 Reply)
Discussion started by: Jae
1 Replies
3. UNIX for Dummies Questions & Answers
I have a file that has dates like this:
date FINAL_RESULT; 7
date FINAL_RESULT; 2
date FINAL_RESULT; 5
With this command: seira=`cut -f2 -d\; tes.txt` i take the date FINAL RESULTs and i store them on variable seira.then seira look like this: 6 3 8
I want to read seira and make a sum of all... (4 Replies)
Discussion started by: psalas
4 Replies
4. Shell Programming and Scripting
Hi,
I have this problem that there are blank spaces in my text file... i want to remove them
line 1
line 2
line 3
I want to remove the space between line 2 and line 3... I tried sed... it work but it prints the whole text file at the command prompt which i dont want....
sde i tried was... (4 Replies)
Discussion started by: bhagya2340
4 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I'm a newbie to shell scripting and I have the following problem:
I need all spaces between two letters or a letter and a number exchanged for an underscore, but all spaces between a letter and other characters need to remain. Searching forums didn't help...
One example for clarity:
... (3 Replies)
Discussion started by: Cpt_Cell
3 Replies
6. Shell Programming and Scripting
Hi all,
Been trying to find a solution to this, I'm sure its a sed 1 liner, but I don't know sed well enough to work it out...
I have a text file in the following format:
431 666 1332 2665 0.24395
432 670 ... (3 Replies)
Discussion started by: mpcengineering
3 Replies
7. Shell Programming and Scripting
hi,
Does anyone has any idea in adding few blank spaces at the end of every record in a file.
Eg:
file.txt
Baby Boy Kim 1234
Baby Boy Vik 1334
Desired output:-
output.txt
Baby Boy Kim 1234
Baby Boy Vik 1334
I want to add 10 blank spaces at the end every record in file.txt (3 Replies)
Discussion started by: techmoris
3 Replies
8. UNIX for Dummies Questions & Answers
Hello,
I am an super newbie, so forgive my sheer ignorance. I have a series of text files formatted as follows (just showing the header and first few lines):
mean_geo mean_raw lat lon
0.000 0 -70.616 163.021
0.000 0 -70.620 163.073
0.000 ... (8 Replies)
Discussion started by: vtoniolo
8 Replies
9. Shell Programming and Scripting
Hello, could you please help with this one. I have an input file like this:
123,4567,89000
123456789,9876543,12
and for the output I need strings to be with the fixed length, let's say 15, and if the string is -lt 15 to be populated with blanks at the end until it reach 15, like this:
123 ,4567... (1 Reply)
Discussion started by: apenkov
1 Replies
10. UNIX for Advanced & Expert Users
Hi Gurus,
Somebody can say me how to delete blank spaces and blank lines in a file unix, please.
Thank you for advanced. (10 Replies)
Discussion started by: systemoper
10 Replies
LEARN ABOUT DEBIAN
html::strip
Strip(3pm) User Contributed Perl Documentation Strip(3pm)
NAME
HTML::Strip - Perl extension for stripping HTML markup from text.
SYNOPSIS
use HTML::Strip;
my $hs = HTML::Strip->new();
my $clean_text = $hs->parse( $raw_html );
$hs->eof;
DESCRIPTION
This module simply strips HTML-like markup from text in a very quick and brutal manner. It could quite easily be used to strip XML or SGML
from text as well; but removing HTML markup is a much more common problem, hence this module lives in the HTML:: namespace.
It is written in XS, and thus about five times quicker than using regular expressions for the same task.
It does not do any syntax checking (if you want that, use HTML::Parser), instead it merely applies the following rules:
1. Anything that looks like a tag, or group of tags will be replaced with a single space character. Tags are considered to be anything
that starts with a "<" and ends with a ">"; with the caveat that a ">" character may appear in either of the following without ending
the tag:
Quote
Quotes are considered to start with either a "'" or a """ character, and end with a matching character not preceded by an even
number or escaping slashes (i.e. """ does not end the quote but "\\"" does).
Comment
If the tag starts with an exclamation mark, it is assumed to be a declaration or a comment. Within such tags, ">" characters do not
end the tag if they appear within pairs of double dashes (e.g. "<!-- <a href="old.htm">old page</a> -->" would be stripped
completely).
2. Anything the appears within so-called strip tags is stripped as well. By default, these tags are "title", "script", "style" and
"applet".
HTML::Strip maintains state between calls, so you can parse a document in chunks should you wish. If one chunk ends half-way through a tag,
quote, comment, or whatever; it will remember this, and expect the next call to parse to start with the remains of said tag.
If this is not going to be the case, be sure to call $hs->eof() between calls to $hs->parse().
METHODS
new()
Constructor. Can optionally take a hash of settings (with keys corresponsing to the "set_" methods below).
For example, the following is a valid constructor:
my $hs = HTML::Strip->new(
striptags => [ 'script', 'iframe' ],
emit_spaces => 0
);
parse()
Takes a string as an argument, returns it stripped of HTML.
eof()
Resets the current state information, ready to parse a new block of HTML.
clear_striptags()
Clears the current set of strip tags.
add_striptag()
Adds the string passed as an argument to the current set of strip tags.
set_striptags()
Takes a reference to an array of strings, which replace the current set of strip tags.
set_emit_spaces()
Takes a boolean value. If set to false, HTML::Strip will not attempt any conversion of tags into spaces. Set to true by default.
set_decode_entities()
Takes a boolean value. If set to false, HTML::Strip will decode HTML entities. Set to true by default.
LIMITATIONS
Whitespace
Despite only outputting one space character per group of tags, and avoiding doing so when tags are bordered by spaces or the start or
end of strings, HTML::Strip can often output more than desired; such as with the following HTML:
<h1> HTML::Strip </h1> <p> <em> <strong> fast, and brutal </strong> </em> </p>
Which gives the following output:
" HTML::Strip fast, and brutal "
Thus, you may want to post-filter the output of HTML::Strip to remove excess whitespace (for example, using "tr/ / /s;"). (This has
been improved since previous releases, but is still an issue)
HTML Entities
HTML::Strip will only attempt decoding of HTML entities if HTML::Entities is installed.
EXPORT
None by default.
AUTHOR
Alex Bowley <kilinrax@cpan.org>
SEE ALSO
perl, HTML::Parser, HTML::Entities
perl v5.14.2 2011-11-15 Strip(3pm)