|
|
|
|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | 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 | Rate Thread | Display Modes |
|
|||
|
getting the data in some format
HI i am writing a shell script to generate some files having data in some format.
for this i am using awk -F":" '{printf("%-20s:%-20s:%-20s:%-20s:%-15s:%-3s:%-19s:%-2s:%-20s:%-15s:%-2s\n", $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)}' $DIALPBIN/temp1.txt > ${DIALPBIN}/temp2.txt this helps in generating the data in correct format. but if some fields are greater than the mentioned field lenght. it doesn't truncate the data. instead the whole data ia written and goes beyond the depicted length. could you please help so that the data do not go beyond the mentioned length and automatically gets truncated ![]() |
| Sponsored Links | ||
|
|
|
|||
|
Code:
jb>printf "%-5s\n" "12345678" 12345678 jb>printf "%-5.5s\n" "12345678" 12345 jb> |
| Sponsored Links |
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help me to format this data please | glev2005 | UNIX for Dummies Questions & Answers | 11 | 04-17-2009 02:20 PM |
| Please help me format this data | glev2005 | UNIX for Dummies Questions & Answers | 4 | 11-24-2008 06:34 PM |
| converting a tabular format data to comma seperated data in KSH | Hemamalini | UNIX for Dummies Questions & Answers | 2 | 06-16-2008 05:37 AM |
| data format from (4.56 0.7) -> 4.6(7) awk?! | ahan | Shell Programming and Scripting | 4 | 05-07-2006 09:53 PM |
| format data | inquirer | Shell Programming and Scripting | 2 | 09-24-2003 07:59 AM |