Advertisement

08.06.2008 at 06:19AM PDT, ID: 23625497
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

Need a shell script to copy html files from remote sever, read those html file and extract the particular data and put the data in new file

Asked by kvjajoo in Shell Scripting, Linux Administration, Bourne-Again Shell (bash)

Tags: ,

Hi,

I have been give a task to collect the usage stats from multiple virtual hosts we have on linux web server and put the summary of the data into new text or excel spreadsheet. Below is the explanation:

We have a linux web server which host multiple virtual hosts. Each of host site generate the html file at the end of each month which contain the information as follows :

Total Hits       418741
Total Files       377639
Total Pages       143324
Total Visits       29678
Total KBytes       15715617
Total Unique Sites       11912
Total Unique URLs       2722
Total Unique Referrers       2314
Total Unique Usernames       2
Total Unique User Agents       1251

This html file is generated by  Webalizer.  The html file is stored in /var/www/vhosts/<vhostname>/statistics/webstat/usage_<year><month>.html
For example : var/www/vhosts/xyz.com/statistics/webstat/usage_200806.html

Following are the html codes from the html file which displays the above data.

<TR><TD WIDTH=380><FONT SIZE="-1">Total Hits</FONT></TD>
<TD ALIGN=right COLSPAN=2><FONT SIZE="-1"><B>279242</B></FONT></TD></TR>
<TR><TD WIDTH=380><FONT SIZE="-1">Total Files</FONT></TD>
<TD ALIGN=right COLSPAN=2><FONT SIZE="-1"><B>209861</B></FONT></TD></TR>
<TR><TD WIDTH=380><FONT SIZE="-1">Total Pages</FONT></TD>
<TD ALIGN=right COLSPAN=2><FONT SIZE="-1"><B>44464</B></FONT></TD></TR>
<TR><TD WIDTH=380><FONT SIZE="-1">Total Visits</FONT></TD>
<TD ALIGN=right COLSPAN=2><FONT SIZE="-1"><B>9029</B></FONT></TD></TR>
<TR><TD WIDTH=380><FONT SIZE="-1">Total KBytes</FONT></TD>
<TD ALIGN=right COLSPAN=2><FONT SIZE="-1"><B>15578780</B></FONT></TD></TR>
<TR><TH HEIGHT=4></TH></TR>
<TR><TD WIDTH=380><FONT SIZE="-1">Total Unique Sites</FONT></TD>
<TD ALIGN=right COLSPAN=2><FONT SIZE="-1"><B>5606</B></FONT></TD></TR>
<TR><TD WIDTH=380><FONT SIZE="-1">Total Unique URLs</FONT></TD>
<TD ALIGN=right COLSPAN=2><FONT SIZE="-1"><B>204</B></FONT></TD></TR>
<TR><TD WIDTH=380><FONT SIZE="-1">Total Unique Referrers</FONT></TD>
<TD ALIGN=right COLSPAN=2><FONT SIZE="-1"><B>1025</B></FONT></TD></TR>
<TR><TD WIDTH=380><FONT SIZE="-1">Total Unique User Agents</FONT></TD>
<TD ALIGN=right COLSPAN=2><FONT SIZE="-1"><B>605</B></FONT></TD></TR>


Now i have one more linux box which can access this web server box via ssh or sftp with root credentials. I want a shell script which will be executed on the linux box (not web server) should do the following :

1. copy the latest usage_<year><month>.html from each virtual host's webstats directory from the web server  ( please note the html file's names are similer for each host so the vhost name should be appended in the begining of the file so the new file will be <vhostname>usage_<year><month>.html

2. grab the data i want ( i have mention the required data in begining) from html files and put them into one single in one vhost data in one line format so i can paste them in excel. So the format should be somthing like this : <vhostname>  <Total Hits> <Total Files> <Total Pages> <Total Visits> and so on ....

I am a absolute beginner in shell scripting area.Start Free Trial
[+][-]08.07.2008 at 04:01PM PDT, ID: 22186268

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]08.07.2008 at 05:41PM PDT, ID: 22186726

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Shell Scripting, Linux Administration, Bourne-Again Shell (bash)
Tags: Shell Script, Linux shell scripting
Sign Up Now!
Solution Provided By: Redimido
Participating Experts: 2
Solution Grade: A
 
 
[+][-]08.07.2008 at 06:49PM PDT, ID: 22186977

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]08.07.2008 at 06:53PM PDT, ID: 22186994

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.08.2008 at 12:24AM PDT, ID: 22188029

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.12.2008 at 11:39AM PDT, ID: 22215739

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.12.2008 at 11:42AM PDT, ID: 22215770

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628