INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

set padding character to dot

set padding character to dot

(OP)
ok, this is just cosmetics but... smile

My Script acts similar to init (or rc depending on the UNIX), it executes a Script and prints out a message about the return code
The output should look like this:
2008-11-18 11:53:27 Starting Application Blahblah ............. FAILED
2008-11-18 11:54:03 Starting Daemon Whatelse .................. OK

but it looks like this (no padding at all):
2008-11-18 11:53:27 Starting Application Blahblah FAILED
2008-11-18 11:54:03 Starting Daemon Whatelse OK

but it looks like this (padding icharacter is a blank):
2008-11-18 11:53:27 Starting Application Blahblah               FAILED
2008-11-18 11:54:03 Starting Daemon Whatelse                    OK

Well, I have som experience in writing C/C++ code, I could write my own function, BUT

Is there an easy way to use printf, awk or something to set padding to eg a dot? (I am on a hp-ux 11.23 box if this is an issue)

Best Regards, Franz
--
System Manager (Solaris, HP-UX, Linux, some networking, some SAN)

RE: set padding character to dot

Or you can use printf command:


dots='......................................................................'

date=$(date +'%Y-%m-%d')
time=$(date +'%T')
mesg='Starting Application Blahblah'
...
rslt=FAILED
printf "%10s %8s %-50.50s %s\n" ${date} ${time} "${mesg} ${dots}" ${rslt}

date=$(date +'%Y-%m-%d')
time=$(date +'%T')
mesg='Starting Daemon Whatelse'
...
rslt=OK
printf "%10s %8s %-50.50s %s\n" ${date} ${time} "${mesg} ${dots}" ${rslt}

HTH,

p5wizard

RE: set padding character to dot

(OP)
thank you for your ideas, they where very helpful!

Best Regards, Franz
--
System Manager (Solaris, HP-UX, Linux, some networking, some SAN)

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close