Output columns needs to be aligned


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Output columns needs to be aligned
# 1  
Old 11-06-2009
Output columns needs to be aligned

Hi All

I'm running a shell script and the output is something like:

Code:
Col1           Col2       Col3
aaaa      aaaaaaa   aaaaa
bbbbb       bbbbb      bbbbbb
ccc        cccccc    ccccccc

But I require the output to printed as given below:
Code:
Col1           Col2          Col3
aaaa          aaaaaaa     aaaa
bbbbb         bbbbb       bbbbbb
ccc           cccccc      ccccccc

Thanks in advance,
Kamal

Last edited by Franklin52; 11-06-2009 at 10:26 AM.. Reason: Please use code tags!!
# 2  
Old 11-06-2009
Post your script, and we'll see how we can assist.

Regards
# 3  
Old 11-06-2009
I'm displaying the output using the below echo statement

echo " $line $TAB $TAB $line2 $TAB $TAB $(head -1 /tmp/alias_names.list) $TAB $TAB $TAB $(awk -F" " '{print $2}' /tmp/port.list) "
# 4  
Old 11-06-2009
Not enough information, post the contents of the variables $line, $line2, the output of
Code:
head -1 /tmp/alias_names.list

the output of
Code:
awk -F" " '{print $2}' /tmp/port.list

and the desired output.
# 5  
Old 11-06-2009
Those two statements are just print a single variable
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Mail sent from variable is not aligned in shell script

Hi Folks :( Scenario, Compared two values in two different files, if file1 value is greater than the value of file2 it trigger mail, I tried this, echo ${usep}; echo ${usep1}; for i in ${!usep}; do if } -gt 80 ]; then if } -gt ${usep1} ]; then ... (9 Replies)
Discussion started by: viay
9 Replies

2. Shell Programming and Scripting

Re-aligned text file into one raw

Hi, Anyone can help on how to re-aligned the data into one raw; Input Text File: TESTA Carbon A China 06/28/2016 Active Vol. 8210, No. 2048, New Era 02/25/2010 ... (1 Reply)
Discussion started by: fspalero
1 Replies

3. Shell Programming and Scripting

[SH] TUI not always properly aligned

Heyas I havent found a thread to introduce, so i combine it with the issue i have. EDIT /* Removed Problem because solved */ My first contact with Linux was back in 1995 with slackware, beeing a gamer back then, i (sadly) didnt bother to dig deeper. I finaly joined the Linux community in... (0 Replies)
Discussion started by: sea
0 Replies

4. Shell Programming and Scripting

Combine columns from many files but keep them aligned in columns-shorter left column issue

Hello everyone, I searched the forum looking for answers to this but I could not pinpoint exactly what I need as I keep having trouble. I have many files each having two columns and hundreds of rows. first column is a string (can have many words) and the second column is a number.The files are... (5 Replies)
Discussion started by: isildur1234
5 Replies

5. Solaris

Partition 0 not aligned on cylinder boundary: "

hi Guys .. user want mirror disk c3t9d0 (running ) to c2t9d0 (fresh hdd). when i tried to bash : prtvtoc /dev/rdsk/c3t9d0s2 | fmthard -s- /dev/rdsk/c2t9d0s2 it showing following error Partition 0 not aligned on cylinder boundary: " 0 4 222 ..... unable to mirror .... plz... (1 Reply)
Discussion started by: coolboys
1 Replies

6. Shell Programming and Scripting

SQL output vertically aligned?

I used the SQL query (taken from other threads here) to get the expected values to be written into a file. myQuery=`sqlplus -s cr_appsrvr/appsrvr@qwi << EndofFile set heading off; set tab off; set wrap off; set pages 0; set feedback off; SELECT CLEARINGHOUSE_TRACE_NUM, INSURED_ID FROM... (4 Replies)
Discussion started by: swame_sp
4 Replies

7. Shell Programming and Scripting

[bash scripting] Generating a table with aligned fields

Hi everyone, I want to write a function which calculates the space needed between fields, to generate a table with aligned fields, like when you type "ls -l", the operating system generates a table with beautifully aligned fields. I've got this code so far: for line in $(cat tmpSearch)... (2 Replies)
Discussion started by: Aveltium
2 Replies

8. Solaris

Error: Memory Address Not aligned

Hi, The following error message occured when I was trying to reboot my SUN machine: Memory address not aligned Its a Sun 280 R , Ultra SPARC III What should I do. Varma (3 Replies)
Discussion started by: gunnervarma
3 Replies

9. Shell Programming and Scripting

Displaying Output in Columns

I'm writing a script to analyze the logs of an smtp relay machine and I'd like the final output to be displayed in columns showing results from the previous day, week, month, and 45 days. The problem I'm running into is that I can't figure out how to display the columns neatly so there is no... (1 Reply)
Discussion started by: jjamd64
1 Replies

10. AIX

df output is not aligned.

When I issue a "df" command the columns of the output are not aligned. QMN012:.../oracle> df -k Filesystem 1024-blocks Free %Used Iused %Iused Mounted on /dev/hd4 524288 439592 17% 5423 6% / /dev/M121A_HOME 3080192 2343764 24% 7263 2%... (1 Reply)
Discussion started by: marcogilbert
1 Replies
Login or Register to Ask a Question