![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | 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. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| printf | arunviswanath | High Level Programming | 2 | 09-19-2007 10:31 PM |
| the printf command | bebop1111116 | Shell Programming and Scripting | 4 | 10-01-2006 01:40 AM |
| printf command in ksh | cin2000 | Shell Programming and Scripting | 1 | 12-21-2005 02:48 PM |
| find: problems escaping printf-command string | grahamb | Shell Programming and Scripting | 1 | 12-04-2005 04:00 PM |
| need help with printf command | nymus7 | Shell Programming and Scripting | 1 | 04-21-2005 08:05 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
printf command
I want to make a logfile with error messages, like this: (collumms: CUSTNR DATE TIME ERROR MESSAGE) Code:
102 20020807 135417 1 Uptime server is more than 6 months 5 20020808 111335 3 Backup not Ok! 2001 20020808 120428 6 Free space at server1 is less than 20% etcetera I made this script: Code:
CUSTNR=101 DATE=`date +%Y%m%d` TIME=`date +%H%M%S` ERROR=1 MESSAGE="Uptime server is more than 6 months" printf "%-8s %-10s %-6s %-6s %-80s\n" $CUSTNR $DATE $TIME $ERROR $MESSAGE >> error.log But the variabele MESSAGE is printed wrong. The logfile looks something likes this: Code:
102 20020807 135417 1 Uptime server is more than 6 months One of the problems are the spaces between de words in the MESSAGE strings. How can I solve this/these problems? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|