Exporting log file into Excel


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Exporting log file into Excel
# 1  
Old 03-22-2011
Exporting log file into Excel

Hi,
I am using HP-UX.
I have an output log file which gives me server statistics.
I want to export the contents of the file(last 100 lines) using tail command and then save it into an excel file in my local machine.
The server statistics should be collected every 3 hrs.
So, i wanted the idea as to how to go about in writing the script so that every 3hrs the batch file runs and exports the log file output into my excel file.

Sample record is given below:
Thu Jan 21 08:35:00 CST 2010 : 1172320 226 613 nqsserver


Let me know your inputs.

Thanks
Harsha
# 2  
Old 03-22-2011
cron is the tool to schedule tasks.
Code:
crontab -e

will get you editing the cron; you want to add a line like:
Code:
*/3 * * * * fetchLog.sh

, which is the instruction to run fetchLog.sh every 3 hours. fetchLog.sh needs to be in your path, so that cron can find it (or call with full path).
But if it's that simple, you don't even need a wrapper script.
Code:
*/3 * * * * tail -100 /path/to/log >> capture.txt

would get you logging.
You can generate a comma separated text file (.csv), that can be imported into M$ Excel.
I recommend you look at crontab in more detail; it's not quite trivial and you should have a good understanding of it before you use it.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to generate Excel file or to SQL output data to Excel format/tabular format

Hi , i am generating some data by firing sql query with connecting to the database by my solaris box. The below one should be the header line of my excel ,here its coming in separate row. TO_CHAR(C. CURR_EMP_NO ---------- --------------- LST_NM... (6 Replies)
Discussion started by: dani1234
6 Replies

2. Shell Programming and Scripting

Need specific columns in a log file as excel.

Hi All... I am in need of few columns from a log file.. in .xls file... below is what i have tried. my log file has 16 colums with " ; " as delimiter, but i need randomn columns 1 2 3 4 5 6 10 11 16 in an excel. I tried to awk the columns with delimiter ; and it worked, below is the log... (5 Replies)
Discussion started by: nanz143
5 Replies

3. Shell Programming and Scripting

Perl script to Merge contents of 2 different excel files in a single excel file

All, I have an excel sheet Excel1.xls that has some entries. I have one more excel sheet Excel2.xls that has entries only in those cells which are blank in Excel1.xls These may be in different workbooks. They are totally independent made by 2 different users. I have placed them in a... (1 Reply)
Discussion started by: Anamika08
1 Replies

4. Shell Programming and Scripting

Writing excel file using perl : Excel file formatting changed

I am trying to create a program where user can input data in certain excel cells using user interface on internet....the programming is on perl and server is unix But when i parse data into excel the formatting of sheets is turned to default and all macro coding removed. What to do...Please... (7 Replies)
Discussion started by: mud_born
7 Replies

5. UNIX for Dummies Questions & Answers

Exporting time from log files

Hi All, I want to export the start time and end time of some jobs in autosys to excel.Could someone please help me with this. I am a begginer in autosys. thanks all,. ---------- Post updated at 01:34 AM ---------- Previous update was at 01:16 AM ---------- someone please help... (3 Replies)
Discussion started by: mahesh300182
3 Replies

6. Shell Programming and Scripting

Remove duplicate commas after exporting excel file to csv

Hello everyone I'm new here and this is my first post so first of all I want to say that this is a great forum and I have managed to found most of my answers in these forums : ) So with that I ask you my first question: I have an excel file which I saved as a csv. However the excel file... (3 Replies)
Discussion started by: Spunkerspawn
3 Replies

7. Shell Programming and Scripting

AutoFilter in Excel report when exporting from Unix

Hi All, Is it possible to have AutoFilter applied in the Excel Sheet which is Exported from UNix server as *.csv file. (0 Replies)
Discussion started by: rawat_me01
0 Replies

8. Shell Programming and Scripting

Retaining the Unix CSV format in Excel format while exporting

Hi All, I have created a Unix Shell script whch creates a *.csv file and export it to Excel. The problem i am facing is that Users wants one of the AMOUNT field in comma separted values. Example : if the Amount has the value as 3000000 User wants to be in 3,000,000 format. This Amount format... (2 Replies)
Discussion started by: rawat_me01
2 Replies

9. Shell Programming and Scripting

Exporting to excel

Can someone help me out to export awk output to excel file in different rows? Plzzzz its urgent...:( (4 Replies)
Discussion started by: goutam_igate
4 Replies

10. UNIX for Advanced & Expert Users

Exporting files from unix to Excel sheet

How can we export a file in unix with certain number of columns to an excel sheet. It's very useful in time saving...... (3 Replies)
Discussion started by: bishweshwar
3 Replies
Login or Register to Ask a Question