Table like formatting in Linux


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Table like formatting in Linux
# 15  
Old 04-01-2018
Hi all,

Thanks for all your patience and help

Its looking bit great from both header and rows perspective

Ideally there should be a standadised package on linux which should do the prettify the csv to table kind of stuff Smilie that would really help .. do we have such tools in unix ?

On screen everything looks good.. I got to post these results into slack channel..which is printing all things ugly..(however that is different story)

I can tell them out my onscreen output is too good


Thanks for all your inputs
# 16  
Old 04-01-2018
Quote:
Originally Posted by onenessboy
Hi all,

Thanks for all your patience and help

[..] I got to post these results into slack channel..which is printing all things ugly..(however that is different story)

[..]
You're welcome. That the slack channel prints ugly may have to do with the use of proportional vs. monospace fonts (hint: You get the monospace font by using "code tags" on this forum Smilie)

Last edited by Scrutinizer; 04-03-2018 at 12:20 AM..
# 17  
Old 04-06-2018
Hi.

We use code align for tasks like this. It automatically aligns, allows more spacing (gutter), etc. Here's an example:
Code:
#!/usr/bin/env bash

# @(#) s1       Demonstrate automatic field alignment, align.

# Utility functions: print-as-echo, print-line-with-visual-space, debug.
# export PATH="/usr/local/bin:/usr/bin:/bin"
LC_ALL=C ; LANG=C ; export LC_ALL LANG
pe() { for _i;do printf "%s" "$_i";done; printf "\n"; }
pl() { pe;pe "-----" ;pe "$*"; }
em() { pe "$*" >&2 ; }
db() { ( printf " db, ";for _i;do printf "%s" "$_i";done;printf "\n" ) >&2 ; }
db() { : ; }
C=$HOME/bin/context && [ -f $C ] && $C align

FILE=${1-data2}

pl " Input data file $FILE, sample, show TABs, clipped to 78"
cat -A $FILE |
cut -c 1-78 |
head

GUTTER=3
pl " Results, spaces for (right) adjustment, gutter=$GUTTER:"
align -st -j_ -ar -g$GUTTER $FILE

exit 0

producing:
Code:
$ ./s1 

Environment: LC_ALL = C, LANG = C
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 3.16.0-5-amd64, x86_64
Distribution        : Debian 8.9 (jessie) 
bash GNU bash 4.3.30
align 1.7.0

-----
 Input data file data2, sample, show TABs, clipped to 78
SERVICE NAME^ITEAM NAME^ICI OWNER^ISECONDARY CONTACT^IPAYCHECK NAME^IDEVV^IADE
checkout^ISARD^Iopalan^IJef May^Iabcdef^IYes^IYes^IYes^IYes^IYes^IYes$

-----
 Results, spaces for (right) adjustment, gutter=3:
SERVICE NAME   TEAM NAME   CI OWNER   SECONDARY CONTACT   PAYCHECK NAME   DEVV   ADEINT   ENV DEV   ENV STAGE   ENV PROD   ENV PROD
    checkout        SARD     opalan             Jef May          abcdef    Yes      Yes       Yes         Yes        Yes        Yes

Here are some details about align:
Code:
align   Align columns of text. (what)
Path    : ~/p/stm/common/scripts/align
Version : 1.7.0
Length  : 270 lines
Type    : Perl script, ASCII text executable
Shebang : #!/usr/bin/perl
Help    : probably available with --help
Home    : http://kinzler.com/me/align/ (doc)
Modules : (for perl codes)
 Getopt::Std    1.10

Best wishes ... cheers, drl
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Web Development

Getting Rid of Annoying Bootstrap Table Borders and Wayward Table Lines

Bootstrap is great; but we have had some issues with Bootstrapped <tables> (and legacy <fieldset> elements) showing annoying, wayward lines. I solved that problem today with this simple jQuery in the footer: <script> $(function(){ $('tr, td, fieldset,... (0 Replies)
Discussion started by: Neo
0 Replies

2. Shell Programming and Scripting

Formatting in a table via shell

Hi I have the below output: 736f14c4-eda2-4531-9d40-9de4d6d1fb0f An account already exists for this email address. Please enter a different email address. c3716baf-9bf8-42da-8a44-a13fff68d20f An account already exists for this email address. Please enter a different email address. Is... (4 Replies)
Discussion started by: ankur328
4 Replies

3. Shell Programming and Scripting

Build a table from a list by comparing existing table entries

I am new to this shell scripting.... I have a file which contains list of users. This files get updated when new user comes into the system. I want to create script which will give a table containing unique list of users. When I say unique, it means script should match table while parsing... (3 Replies)
Discussion started by: dchavan1901
3 Replies

4. Red Hat

Parsing a linux file and formatting it.

Hi, I have a linux file that has data like this.. REQUEST_ID|text^Ctext^Ctext^C REQUEST_ID|text^Ctext^C REQUEST_ID| REQUEST_ID| REQUEST_ID|text^Ctext^Ctext^Ctext^Ctext^Ctext^C.... Where ever I see a ^C character, I need to copy the corresponding REQUEST_ID and that part of the text to a new... (17 Replies)
Discussion started by: charithainfadev
17 Replies

5. Solaris

Linux partitioned disk mounted on OSOL without formatting

Hello and Merry Christmas... Quick question after tireless search around the web. Description: I have a WD My book world edition II that met an untimely death. However the 2 SATA disks inside seem to be working just fine. Want to add either one of them to my Solaris Desktop. Since I... (5 Replies)
Discussion started by: michnmi
5 Replies

6. Shell Programming and Scripting

Insert into Oracle table thru UNIX - linux 2.6.9-89

Hi, I am trying to insert a record into a table (say dips_tbl) which resides in Oracle DB through a ksh script. I want to insert records into few of the table columns-not all. I'll give an e.g. for the date column "CREATE_DATE". For that I first execute SQL1="SELECT SYSDATE FROM DUAL" ... (1 Reply)
Discussion started by: dips_ag
1 Replies

7. Shell Programming and Scripting

select values from db1 table and insert into table of DB2

Hi I am having three oracle databases running in three different machine. their ip address is different. from one of the DB am able to access both the databases.(means am able to select values and insert values in to tables individually.) I need to fetch some data from DB1 table(say DB1 ip is... (2 Replies)
Discussion started by: aemunathan
2 Replies

8. Shell Programming and Scripting

help on formatting output (Table Form)

Data in File ABC:DEFGHI:123 ABCZYE:DEFI:123 ABCFGD:DEF:123 ABCEERRRRR:DEFGHI:123 Expected Format 1 ABC DEFGHIFE 123 2 ABCZYE DEFI 123 3 ABCFGD DEF 123 4 ABCEERRRRR DEFGHI 123 However when i enter the following... (2 Replies)
Discussion started by: blurboy
2 Replies

9. Shell Programming and Scripting

How to obtain system open file table value in Linux

Hello , I want to get current system open file table value. Can any one help. Thanking you, mahesh (0 Replies)
Discussion started by: mahesh.
0 Replies
Login or Register to Ask a Question