Print on the screen a table in ascii


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Print on the screen a table in ascii
# 1  
Old 06-07-2010
Print on the screen a table in ascii

Hi

Is there some kind of generator in the internet which could help me to create a table where i will place some values.

Trying to do this with echo cmd, but maybe you will suggest me some generator fo r this.

thx.

---------- Post updated at 10:59 AM ---------- Previous update was at 10:47 AM ----------

Up to now I have sth like this :
---------------------------------


Code:
--------------------------------------------------------------------------------------------
| ####### |                 Emails                |              Attachments               |
| ####### |                                       |                                        |
--------------------------------------------------------------------------------------------
| Miesiac | Ilosc plikow | Wielkosc plikow (B/KB) | Ilosc plikow | Wielkosc plikow ( B/KB) |
|         |              |                        |              |                         |
--------------------------------------------------------------------------------------------

Moderator's Comments:
Mod Comment This is what your post looked like without code tags:

--------------------------------------------------------------------------------------------
| ####### | Emails | Attachments |
| ####### | | |
--------------------------------------------------------------------------------------------
| Miesiac | Ilosc plikow | Wielkosc plikow (B/KB) | Ilosc plikow | Wielkosc plikow ( B/KB) |
| | | | | |
--------------------------------------------------------------------------------------------

Great, huh?

Last edited by Scott; 06-07-2010 at 08:05 AM.. Reason: Code tags, please...
# 2  
Old 06-07-2010
Use printf.
# 3  
Old 06-07-2010
Hi.

See also [gt]roff table generators tbl, gtbl, t2t (html), many wiki applications.

Here is a simple example of tbl and groff in a script file s1:
Code:
#!/bin/sh

F=${1-2.tbl}

echo
echo " Input file $F (use TABS to separate entries):"
cat -A $F

echo
echo " Results (empty lines omitted):"
echo

tbl $F |
groff -T ascii |
grep -v '^$'

exit 0

producing:
Code:
% ./s1

 Input file 2.tbl (use TABS to separate entries):
Now is the time$
for all good men$
to come to the aid$
of their country.$
.TS$
allbox;$
c c c$
l l l.$
Language^IAuthors^IRuns on$
Fortran^IMany^IAlmost anything$
PL/1^IIBM^I360/370$
C^IBTL^I11/45,H6000,370$
BLISS^ICarnegie-Mellon^IPDP-10,11$
IDS^IHoneywell^IH6000$
Pascal^IStanford^I370$
.TE$

 Results (empty lines omitted):

Now  is  the  time  for  all good men to come to the aid of their
country.
+---------+-----------------+-----------------+
|Language |     Authors     |     Runs on     |
+---------+-----------------+-----------------+
|Fortran  | Many            | Almost anything |
+---------+-----------------+-----------------+
|PL/1     | IBM             | 360/370         |
+---------+-----------------+-----------------+
|C        | BTL             | 11/45,H6000,370 |
+---------+-----------------+-----------------+
|BLISS    | Carnegie-Mellon | PDP-10,11       |
+---------+-----------------+-----------------+
|IDS      | Honeywell       | H6000           |
+---------+-----------------+-----------------+
|Pascal   | Stanford        | 370             |
+---------+-----------------+-----------------+

See man pages for details ... cheers, drl
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Print byte position of extended ascii character

Hello, I am on AIX. When I encounter extended ascii characters and special characters on a file I need to print.. Byte position, actual character and line number. Is there a simple command that can give me the above result ? Thanks in advance (38 Replies)
Discussion started by: rosebud123
38 Replies

2. Shell Programming and Scripting

Print the next ASCII character

Hi, In my file, for few field I have to print the next ASCII character for every character. In the below file, I have to do for the 2,3 and 5th fields. Input File ======== 1|abc|def|5|ghi 2|jkl|mno|6|pqr Expected Ouput file ======= 1|bcd|efg|5|hij 2|klm|nop|6|qrs (2 Replies)
Discussion started by: machomaddy
2 Replies

3. Shell Programming and Scripting

Print variable on screen

Hi, I've stored the output of a command into a variable. The variable contains the following output: outputline1 outputline2 outputline3 ... How can I echo the variable so that the output is as follow and not one line: outputline1 outputline2 outputline2 ... Thanks a lot! (4 Replies)
Discussion started by: Sego
4 Replies

4. Red Hat

alt print screen problems

Can anyone explain why I am having a alt print screen? I am used to alt print screen taking a picture of the top window in focus. Do I need to make a shortcut or something? (0 Replies)
Discussion started by: cokedude
0 Replies

5. Shell Programming and Scripting

Print from screen session

Hello everyone, Following command sends word 'test' followed by an enter into a screen session (in our case screen_1). How do I print the result, if that would result ? How do I print the result, even if the program running in the session is locked ? Thank you :) screen -S screen_1 -X... (5 Replies)
Discussion started by: akula_1986
5 Replies

6. Shell Programming and Scripting

print ascii value of A

i want to print ascill value of A and also want to print A by its ascii value please hel me. (i know ascii of A=97) (4 Replies)
Discussion started by: RahulJoshi
4 Replies

7. AIX

print screen

Hi all, Could you please tell me how to take a screenshot in aix (like Print Screen button in windows)? Thanks (7 Replies)
Discussion started by: prashantchavan
7 Replies

8. UNIX for Dummies Questions & Answers

How to print content on the screen

I have the following questions regrading Unix commands. 1. Could you provide the commands how to print the content of .profile and .shrc files on the screen using more and piple command? or a better way? 2. How can i use the head and tail to display lines from 25 through 75... or a better... (4 Replies)
Discussion started by: aadba
4 Replies

9. UNIX for Advanced & Expert Users

How to print contents on the screen?

I have the following questions regrading Unix commands. 1. Could you provide the commands how to print the content of ".profile" and ".shrc" files on the screen using "more" and "piple" command? 2. How can i use the "head" and "tail" to display lines from 25 through 75... 3. How to search... (1 Reply)
Discussion started by: aadba
1 Replies

10. UNIX for Dummies Questions & Answers

how to print screen in linux

Hi All, Perhaps a dumb question, but how do you do a "print screen" within the X-Window in linux. I'm running KDE, is there a utility I can use in that package that I'm not aware of. Or, is there a way to turn on the <alt><print-screen> function with the keyboard? Thanks in advance. VJ (2 Replies)
Discussion started by: vancouver_joe
2 Replies
Login or Register to Ask a Question