reporting capability with bash
Hallo folks,
I was just wondering if it is possible to have some html reports or tabular reports generated with bash? I have two find command which looks like: Code:
echo " Files of type 1" Code:
echo "Files of type 2" I have no idea where to start, any guidance/pointers would be highly appreciated. Thank you in advance. |
No idea how to do but may be output the fils into two different log files and then read them?
|
how much html coding skill you have?
|
Can you explain what you mean in detail/example?
html & 'table' are not methods of transmission. You can certainly re-format the data using bash and send that via email. Here's some good bash HOWTOs/refs http://rute.2038bug.com/index.html.gz http://tldp.org/LDP/Bash-Beginners-G...tml/index.html http://www.tldp.org/LDP/abs/html/ |
Your question seems to have two components that are distinct different and separate. The first seems to be that of reformatting the data into something that can be somehow published. The second seems to be related to the actual publishing/distributing of the data. The wording of your question seems to indicate that you aren't clear how the two are distinct.
The first part is probably best accomplished with some kind of script that massages text data into some desired format. The desired format really depends on how the data will be viewed. Commonly these days, it may be viewed with a web browser. Other formats may be things like word processor formatting, PDF or PS, latex, some kind of image format, etc. Each of these formats has some attribute that may make them suitable for one purpose or another, and each will require some different tool in order to view or edit them. Accordingly, they may require some particular tool to transform what you have into each particular format. The second part of your objective seems revolve around how the data is to be published. Simply placing the data on some kind of shared filesystem may be adequate. Web servers (HTTP servers) are clearly well known and widely used these days. Using HTML generally implies the use of a web server (although HTML data may be read from filesystem files). Scripts can crafted to send documents of any format by e-mail. Other methods may available to you. You may need to consult someone with local expertise in the matter of setting this kind of thing up. I seems you should do a little re-thinking about what you really want, post your ideas here, and someone can help provide more concise information. --- rod. |
Guys,
Thank you for your input. I believe that I am not good at articulating the reuirements. :( All I want is a table to be recreated. Something like this. Files Type 1(in a table header with some colour say grey) File 1(again follows the same pattern a table with outline border File 2 (table record with a outline border) Files Type 2(in a table header with some clolur say red) File 1 File 2(table record with a outline border) and this whole stuff( i believe is an html page but doesn't need to be) to be sent via email to stakeholder(myself) so how we go about the implementation of this? I truly believe I have made it clear now? |
Convert text to html: http://txt2html.sourceforge.net/
You can send an email with attachment using mailx http://linux.die.net/man/1/mailx; see -a switch. Various methods available eg http://techsatwork.com/blog/?p=1274. Some use uuencode. |
We cannot drop any file into production environment. It needs to be tested before going into any live environment . I believe there must be some quick and easy way with help of awk and sed? I have done with uuencode it just garbages the log file. :(
|
what is generating these text files that you want to read in a web page
a very good example of a very good perl program is AWstats http://awstats.sourceforge.net/ it reads log files ( web page ) and generates a web based page to read but the basic idea can be applied to many different uses |
@John VV
I do not want any external program as it would ages to get it through change process. I don't to be "web page" but in any format which becomes as a report. A table is the one which I am thinking of at this stage. The sample output is as follows: Code:
There are 2 files in h2 directory: |
if you have OpenOffice or LibreOffice
you can use that to create a template then copy/paste the data into it or even use excel ( Calc ) i suggested awstats as an example of a perl script than can auto import data from different sources and format it and output it to a html format "page" one that is well documented ( in the code) and can be easily rewrote |
You do realise that the Perl lang is part of the std install on Linux.
You could write your own code with it. This kind of data munging is one of the things its good at. For a job like this I'd definitely use it rather than awk & have done. |
Perhaps provide a sample of your raw data (and absolutely do post it in [CODE] [/CODE] tags to preserve existing format), and someone can provide a basic script to transform it.
Your description of the output as a 'table' is really meaningless without knowing what application or class of application will render it. You originally said you wanted it to be in HTML, but now you say you don't want a web page; two completely contradictory requirements. If you want it to be rendered with something more complex than a web browser, then transforming the data using primitive tools such as Bash will probably not be practical. If you just want the data to be formatted/structured as plain ASCII text, then Bash is probably very much up to the task. Since part of the problem is to do it with tools already available to you, it would be helpful if you could enumerate what is available. To anyone replying on this list, Perl would certainly fall in the category of tools normally installed in Linux. If that isn't available, then the list must be quite short indeed. --- rod. |
A key question is exactly how you expect the recipient to view this 'table'
There are at least 3 options: 1. html - suitable for a browser to view or to be put on a webpage 2. flat text 'looks like' a table - email, any basic editor 3. csv file - suitable to be imported into a spreadsheet tool eg Excel, which will display it as a 'table' |
All times are GMT -5. The time now is 04:14 PM. |