Add Blank Spaces in text, to perform beter alignment of the string


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Add Blank Spaces in text, to perform beter alignment of the string
# 1  
Old 06-14-2016
Add Blank Spaces in text, to perform beter alignment of the string

Hi Guru,

I need some advice on how to add blank spaces to the code, rather than me just adding <space-bar spaces> which does not work.




Current output of the code

HTML Code:
File System Backed Up - ALL_LOCAL_DRIVES 


Daily - Incremental Backup Schedule - 1 Month Retention 
•  7pm - PRD & DEV WIN 
•  2am - PRD & DEV SQL 

Above Code

Code:
echo "                                                                                                 "  >> $TMP/AUDIT_HEADER
echo " File System Backed Up                             - ALL_LOCAL_DRIVES                     <br>   "  >> $TMP/AUDIT_HEADER
echo "                                                                                          <br>   "  >> $TMP/AUDIT_HEADER
echo "                                                                                          <br>   "  >> $TMP/AUDIT_HEADER
echo " <u> BACKUP SCHEDULE </u>                                                                 <br>   "  >> $TMP/AUDIT_HEADER
echo "                                                                                          <br>   "  >> $TMP/AUDIT_HEADER
echo "                                                                                          <br>   "  >> $TMP/AUDIT_HEADER
echo " Daily - Incremental Backup Schedule               - 1 Month Retention                    <br>   "  >> $TMP/AUDIT_HEADER
echo "                                                                                          <br>   "  >> $TMP/AUDIT_HEADER
echo " <li> 7pm     - PRD & DEV WIN                    </li>                                    <br>   "  >> $TMP/AUDIT_HEADER
echo " <li> 2am     - PRD & DEV SQL                    </li>                                    <br>   "  >> $TMP/AUDIT_HEADER
echo "                                                                                          <br>   "  >> $TMP/AUDIT_HEADER
echo "                                                                                          <br>   "  >> $TMP/AUDIT_HEADER




Preferred output


HTML Code:
File System Backed Up                     - ALL_LOCAL_DRIVES 


BACKUP SCHEDULE 

Daily - Incremental Backup Schedule       - 1 Month Retention 
•  7pm         - PRD & DEV WIN 
•  2am         - PRD & DEV SQL

Can you tell me how i can achieve this via the code, for the above output.

Thanks
# 2  
Old 06-14-2016
How about using <pre> and </pre> at beginning and end of file?
# 3  
Old 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 &nbsp; (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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Delete blank spaces and blank lines in a file

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

2. Shell Programming and Scripting

append blank spaces at the end of a variable string

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

3. UNIX for Dummies Questions & Answers

Removing blank spaces from text files in UNIX

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

4. Shell Programming and Scripting

how to add blank spaces at the end of every record in a file.

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

5. Shell Programming and Scripting

Replace blank spaces with semicolon - text file

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

6. UNIX for Dummies Questions & Answers

selective removal of blank spaces in string

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

7. Shell Programming and Scripting

Remove blank spaces in a text file...

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

8. UNIX for Dummies Questions & Answers

string with blank spaces

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

9. Shell Programming and Scripting

Replace blank spaces by single tab, and right alignment

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

10. Shell Programming and Scripting

remove blank spaces in a string

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
Login or Register to Ask a Question