LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-23-2013, 07:41 AM   #1
sysmicuser
Member
 
Registered: Mar 2010
Posts: 332

Rep: Reputation: 0
Unhappy 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"
find . -type f -mtime 2 -printf "%f\n"|grep -v A1 >> FILE
Code:
echo "Files of type 2"
find . -type f -mtime 4 -printf "%f\n" |grep -v A2 >> FILE
Now I was wondering if it is possible to have report sent via html or via table?

I have no idea where to start, any guidance/pointers would be highly appreciated.

Thank you in advance.
 
Old 04-23-2013, 07:44 AM   #2
sysmicuser
Member
 
Registered: Mar 2010
Posts: 332

Original Poster
Rep: Reputation: 0
No idea how to do but may be output the fils into two different log files and then read them?
 
Old 04-23-2013, 07:51 AM   #3
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,195
Blog Entries: 10

Rep: Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986
how much html coding skill you have?
 
Old 04-23-2013, 07:53 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
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/
 
Old 04-23-2013, 02:14 PM   #5
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.
 
Old 04-23-2013, 08:05 PM   #6
sysmicuser
Member
 
Registered: Mar 2010
Posts: 332

Original Poster
Rep: Reputation: 0
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?
 
Old 04-23-2013, 09:05 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
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.
 
Old 04-23-2013, 09:18 PM   #8
sysmicuser
Member
 
Registered: Mar 2010
Posts: 332

Original Poster
Rep: Reputation: 0
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.
 
Old 04-23-2013, 11:40 PM   #9
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 16,830

Rep: Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409
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
 
Old 04-24-2013, 12:37 AM   #10
sysmicuser
Member
 
Registered: Mar 2010
Posts: 332

Original Poster
Rep: Reputation: 0
Unhappy

@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:
/h1/h2/h3/1.txt
/h1/h2/h3/2.txt
This comes to be as a email as pure text however I want as a table so it becomes as a report. Just matter of reformatting to neat,tidy and presentable output.

Last edited by sysmicuser; 04-24-2013 at 12:41 AM.
 
Old 04-24-2013, 12:54 AM   #11
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 16,830

Rep: Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409
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
 
Old 04-24-2013, 01:41 AM   #12
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
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.
 
Old 04-24-2013, 11:35 AM   #13
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.

Last edited by theNbomr; 04-24-2013 at 11:37 AM.
 
Old 04-25-2013, 03:47 AM   #14
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
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'
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] df reporting 100% but du reporting 20% guna_pmk Linux - Server 1 04-15-2011 12:34 PM
Bash reporting 2.9e+02 instead of 2900 Toadman Linux - General 3 02-26-2007 06:51 PM
Capability g26108 Linux - General 1 09-30-2005 05:47 PM
I can do it with less capability! Anniebaby Linux - Security 3 10-30-2003 09:51 PM
Linux Capability nitr0gen Programming 0 02-15-2002 08:31 AM


All times are GMT -5. The time now is 06:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration