Operating System - HP-UX
1822494 Members
2422 Online
109642 Solutions
New Discussion юеВ

Script output in table format

 
Starrynight
Advisor

Script output in table format

Hi everybody

I got a script that gives a lot of numeric output and now I want to put in table format....I just don??t know how!!! Is this possible to do?
If so...how can I do it?
I am really lost here...

Thanks in advance
SN
System administrator
6 REPLIES 6
James R. Ferguson
Acclaimed Contributor

Re: Script output in table format

Hi:

The easist way is to use formatted printing with 'printf'. See the man pages for more information.

Regards!

...JRF...
Kent Ostby
Honored Contributor

Re: Script output in table format

You can use awk to format your output depending on how predictable the output data is.

If you tell me what the output looks like now and what you'd like it to look like, I can help you out.


"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
Ralph Grothe
Honored Contributor

Re: Script output in table format

If you already have a shell script I'd also think that a little extension that uses the printf command as already suggested would be the quickest solution.

If you have ever coded in C (or any syntactic C-alikes like Java, Perl, awk, Python etc.) you know how to use it.

On the other hand this is a true job for Perl (remember its acronym originally stood for "Practical Reporting and Extraction Language", though we all know that it stands for "Pathologically Eclectic Rubbish Lister").
See, the emphasis used to be on report generation.
For anything having to do with parsing, formatting, filtering text Perl to the rescue.
Madness, thy name is system administration
Chris Vail
Honored Contributor

Re: Script output in table format

The others comments about PERL, C and printf are all good. However, I suggest using echo statements, with either tab characters or commas between fields. The tab characters are crude, but they often work. The commas are good because you can then save your work with a .csv extension and open your document with Excel or some other spreadsheet program.

The command echo "$DATA1,$DATA2">>FILE is all you need. Then attach the file as a MIME compliant document with "uuencode FILE FILE|mailx -s "My subject" me@myplace.com. When it shows up in your email, just double-click on the attachment, and it will automatically open up in Excel.

Of course, this assumes that you have email working......if not, just ftp the document to your workstation, then double click.


Chris
Francisco J. Soler
Honored Contributor

Re: Script output in table format

Hi, SN

If you want HTML format in the output you can do this very easily wiht the tags
and .

Frank.
Linux?. Yes, of course.
Starrynight
Advisor

Re: Script output in table format

Hi all

I solved my problem with echo and printf.
Thank you all.

SN
System administrator