|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
formatting tab with even size
I have a number of columns separated by tabs but the spacing between them are of different sizes. Is there any way of separating them with tab of even size?
Thank you. |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
you can format the output with printf. Code:
echo 'x y' | awk '{printf "%s%16s\n", $1, $2}'
x y |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Sorry for asking something which may be obvious but what do %s and %16s mean?
Thank you. |
|
#4
|
|||
|
|||
|
those are formatting specifiers of printf.
google printf for more information. %s is for string. %16s means prints the $2 as a string of 16 characters (right justified). |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Have a read of Using printf Statements for Fancier Printing.
|
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Directory size larger than file system size? | sparcman | Solaris | 6 | 12-10-2009 09:21 AM |
| find with file size and show the size | rpraharaj84 | Shell Programming and Scripting | 3 | 10-06-2009 01:42 PM |
| Formatting | mirusnet | Shell Programming and Scripting | 3 | 01-06-2008 10:38 PM |
| command to find out total size of a specific file size (spread over the server) | abhinov | Solaris | 3 | 08-08-2007 06:48 AM |
| bash script working for small size files but not for big size files. | davidpreml | Shell Programming and Scripting | 1 | 11-01-2006 10:06 AM |
|
|