Visit Our UNIX and Linux User Community


Bash: Advice put data in a table


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bash: Advice put data in a table
# 1  
Old 10-21-2009
Bash: Advice put data in a table

Hi

I get some differents output from a bash script.
My goal is to sort them in a kind of table, something like:

Quote:
############ TABLE ###############
__________________________________
# field1 | field2 |....................| fieldn |
# val1 val2
#
#_________________________________
Actually the table can change and I don't care about the shape, I'm just looking if there's a well know way to put the output of a script in a table or if someone has his own best way to do that.

Any idea will be appreciate

thanks

D.
# 2  
Old 10-21-2009
Try tabs.

Code:
echo "----------------------------------------------------------------------"
echo -e "col1\tcol2\tcol3\tcol4\tcol5\tcol6\tcol7"
echo "----------------------------------------------------------------------"
echo -e "a\tb\tc\td\te\tf\tg"
echo -e "ab\tbc\tcd\tde\tef\tfg\tgh"

The tabs will make the columns line up within 8 character stops.
# 3  
Old 10-21-2009
thank you.

I'm trying, it seems like work fine.

thx for reply
D.

Previous Thread | Next Thread
Test Your Knowledge in Computers #573
Difficulty: Medium
PHP does not allow you to use arrays as both function parameters and as return types.
True or False?

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to run several bash commands put in bash command line?

How to run several bash commands put in bash command line without needing and requiring a script file. Because I'm actually a windows guy and new here so for illustration is sort of : $ bash "echo ${PATH} & echo have a nice day!" will do output, for example:... (4 Replies)
Discussion started by: abdulbadii
4 Replies

2. Shell Programming and Scripting

Put repeated values into a table

Hi all, I have blocks of records like the following, each block ends in = in a new line, I want tabularize the entire output. The pattern is the same in every block although not all types are there in every block. For example gine3 is absent in the second block but present first and third. ... (7 Replies)
Discussion started by: ritakadm
7 Replies

3. Shell Programming and Scripting

SFTP bash put/get/rm check

Hello, i'm doing something like that #!/bin/sh sftp 172.18.255.140 <<End-Of-Session >> /usr/batch/logsftp.txt user batch ascii lcd /usr/batch get olaola.txt bye End-Of-Session   if then echo MAL >> /usr/batch/logsftp.txt echo $? >> /usr/batch/logsftp.txt exit $? else echo... (16 Replies)
Discussion started by: dexposit
16 Replies

4. Shell Programming and Scripting

Bash shell script that inserts a text data file into an HTML table

hi , i need to create a bash shell script that insert a text data file into an html made table, this table output has to mailed.I am new to shell scripting and have a very minimum idea of shell scripting. please help. (9 Replies)
Discussion started by: intern123
9 Replies

5. UNIX for Dummies Questions & Answers

Bash script to insert data into an html table

hi, I need to create a bash shell script which picks up data from a text file and in the output file puts it into an html made table. I have to use sed and awk utilties to do this the input text file will contain data in the format: job name para1 para2 para3 para4 para4 1 ... (1 Reply)
Discussion started by: intern123
1 Replies

6. UNIX for Advanced & Expert Users

distributed hash table operations(GET,PUT,TRANSFER) implementation

Hi, i want to implement hash table (put, get and transfer operations) using c in unix. so give some nice infromation on how to write my code. (1 Reply)
Discussion started by: kaleab
1 Replies

7. Solaris

Can I put my own tags in a partition table

I have X4500 running Solaris 10. I have formatted a disk and created partition table as given below. Specify disk (enter its number): 0 selecting c0t0d0 /dev/dsk/c0t0d0s0 is part of active ZFS pool zpool1. Please see zpool(1M). FORMAT MENU: disk - select a disk ... (3 Replies)
Discussion started by: bharu_sri
3 Replies

8. UNIX for Dummies Questions & Answers

Advice on extracting special characters from a DB2 table to a file in the UNIX ENV

need some advice on the following situation. I have a DB2 table which has a varchar Column. This varchar column can have special characters like , , . When I extract from this table to a sequential file for this varchar column I am only able to get and . To Get the ... (1 Reply)
Discussion started by: cosec
1 Replies

9. Shell Programming and Scripting

Put raw data to column data

Dear all, I want below data to make it in column format.so i will see the data like this cdrID teleServiceCode chargedPartyNumber ... ... ... ... "egmailcom0w10ggzx00" 'sMS (5)' "716323770" "m17ifi5z30w0z6o7200" 'sMS (5)' ... (7 Replies)
Discussion started by: Nayanajith
7 Replies

Featured Tech Videos