Re: text formatting question

From: Adam Price (adam+usenet_at_pappnase.co.uk)
Date: 03/26/04

  • Next message: rc: "Re: text formatting question"
    Date: Fri, 26 Mar 2004 06:10:39 +0000
    
    

    On Fri, 26 Mar 2004 05:48:34 GMT, cmiller0470@earthlink.net wrote:

    > Hello, all.
    >
    > I've been lurking in this group for some time now, and have picked up
    > several helpful pointers from all of you. Thanks for that, and I'm
    > hoping you can maybe help me with a question of my own...
    >
    >
    > I have been tasked with taking a system log from one of my applications
    > and turning it into a human readable 'daily report,' to be sent out each
    > day via a cron job. I have no 'formal' UNIX training, per se, but have
    > learned much due to the assumption on the part of my employer that, since
    > I know what UNIX is, I must be some sort of guru on the subject.
    > Basically, they tossed the baby into the water, and hoped it could swim.
    >
    > Well... I make no claims to be any sort of olympic athlete, but I
    > believe I've at least learned to do the backstroke :-)
    >
    > Here's my question.
    >
    > I am using 'grep' and 'grep -v' to filter out the events from the log
    > that I am interested in. I am using 'cut' to chop off the nasty bits at
    > the beginning and end of each line that I don't want to see. I am using
    > 'tr 'xx' 'yy' ' and 'sed s/xx/yy/g' to further make the report more
    > readable. Basically, shove it down the pipeline, and trim one bit off at
    > a time.
    >
    > Here's my question:
    >
    > How the heck do I get the resulting information to line up in nice, neat
    > columns, such as a management type would like to see?????
    >
    > TIA,
    >
    > Chris
    >
    >
    >
    >
    > Asked here, Hope to see the answer(s) here.

    Seriously, this looks like the sort of job that perl was made for.
    I would be inclined to re-write the whole script in perl.
    If you can't or don't want to do that then you can use printf to output
    formatted strings.
    Awk could also probably do most of what you want.
    If you really want to make it management friendly, the you could output the
    data comma separated and then feed in into a spread*** for them.
    Or you could output html tables.
    If you take the thing over to comp.unix.shell, give them the code you
    already have and an example input and desired output then they will
    undoubtedly help.
    Adam Price


  • Next message: rc: "Re: text formatting question"