Smart questions
Smart answers
Smart people
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 now!
  • 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.

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

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.

daFranze (TechnicalUser)
18 Nov 08 6:44
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)

Helpful Member!  PHV (MIS)
18 Nov 08 9:35
A starting point:
x='.......................................................'
y='2008-11-18 11:53:27 Starting Application Blahblah'
z='2008-11-18 11:54:03 Starting Daemon Whatelse'
echo `expr substr "$y $x" 1 70` FAILED
echo `expr substr "$z $x" 1 70` OK

Hope This Helps, PH.
FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?

Helpful Member!  p5wizard (IS/IT--Management)
18 Nov 08 10:43
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

daFranze (TechnicalUser)
18 Nov 08 10:59
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!

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