Sponsored Content
Full Discussion: data for spreadsheet
Top Forums Shell Programming and Scripting data for spreadsheet Post 302692433 by dwcasey on Monday 27th of August 2012 04:16:06 PM
Old 08-27-2012
perfect

Quote:
Originally Posted by RudiC
Still he/she might want an answer to his/her problem. Try this:
Code:
awk '   BEGIN {printf "lun,date,sdd sz,hdd sz"}
        /^$/ {sameline=0; next}
        {if (!sameline || oldfn!=FILENAME) {printf "%s%s", ORS, FILENAME; oldfn=FILENAME; sameline=1}}
        {if ($2=="") printf ",%s", $1};
        /capacity/  {printf ",%s", $2};
        END {print ""}
        ' serv*

Holy smokes :O that worked perfectly. The last three are where I added the date. Thanks so much.

lun,date,sdd sz,hdd sz
serv01_lun01.out,1.06GB,248.94GB
serv01_lun01.out,1.06GB,248.94GB
serv01_lun01.out,1.06GB,248.94GB
serv01_lun01.out,960.00MB,249.06GB
serv01_lun01.out,08/25/12,960.00MB,249.06GB
serv01_lun01.out,08/26/12,896.00MB,249.12GB
serv01_lun01.out,08/27/12,896.00MB,249.12GB

---------- Post updated at 03:03 PM ---------- Previous update was at 02:56 PM ----------

Quote:
Originally Posted by DGPickett
If you put it into a database daily, there is much less to format. If you format as you collect, in distributed collection scripts, bash could do all the parsing necessary to make each row. A cron on each host could ensure the data is collected same time every day, or even hourly, even if the network or report host is down. The report host could collect the files via ssh, rsync, rsh, ftp or they could NFS to the report host from local on the end host (not the other way around, see prior sentence).
I have a perl script I use to pull down Cisco switch info and use a perl DB mod to shove it into a DB. Might do that with data as well.

At present, wanted a quick way to put it into Excel, next is to put it on a webpage/dashboard, then I'll look at the DB option.

---------- Post updated at 03:16 PM ---------- Previous update was at 03:03 PM ----------

Now that I'm reading the comments, I see what you guys mean. This actually might be a better way overall to report on the data. Create something like:

Code:
serv01_lun01
08/25/2012,100,250
08/26/2012,105,245
08/27/2012,110,240

serv12_lun03
08/25/2012,55,100
08/26/2012,60,95
08/27/2012,60,95

Can the awk script be easily modified to do something like this instead?

Dunno...now that I'm thinking more about DB stuff, wondering how my columns might look. the LUN name will always be the same. The date and sizes are what are changing.
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

help in Spreadsheet::WriteExcelXML

I want to know that will Spreadsheet::WriteExcelXML coding will work in unix with perl and shell scripting. (1 Reply)
Discussion started by: akash
1 Replies

2. Shell Programming and Scripting

Converting HTML data into a spreadsheet

Hi, I have a perl script that prints some data in the form of a table (HTML table) Now, I want to be able to convert this data into a report on an Excel sheet. How can I do this? Regards, Garric (4 Replies)
Discussion started by: garric
4 Replies

3. AIX

Trying to send an excel spreadsheet.

I may have posted in the wrong section, either way I need some help. And I have to modify this part of the script, I'm not sure what to change the content-type to for this to work, or what else I would need to change here: # This script sends Email acoording to command line arguments. #... (1 Reply)
Discussion started by: NycUnxer
1 Replies

4. Shell Programming and Scripting

Trying to send an excel spreadsheet.

And I have to modify this part of the script, I'm not sure what to change the content-type to for this to work, or what else I would need to change here: # This script sends Email acoording to command line arguments. # $1 - file to be attached (full path with name) # $2 - file name as it... (1 Reply)
Discussion started by: NycUnxer
1 Replies

5. Shell Programming and Scripting

Renaming files based on data in a spreadsheet

I have a spreadsheet in a folder that looks like this: Sector1...Sector2...Sector3...Sector4...Sector5...Sector6...Sector7 SomeID....Title.......SomeID...SomeID....SomeID...SomeID....SomeID OtherID...MyTitle....SomeID...SomeID....SomeID...SomeID....SomeID... (7 Replies)
Discussion started by: Xterra
7 Replies

6. Shell Programming and Scripting

Using Spreadsheet on Perl in UNIX

Very new to UNIX, so still getting used to all this. I made a Perl script where I want to create a spreadsheet file when extracting "data" from a text file. Now, this works perfectly fine on my Windows OS since I'm using the Win32 libraries with Microsoft Excel, but when I want to try it out on... (0 Replies)
Discussion started by: kooshi
0 Replies

7. Shell Programming and Scripting

Can't locate Spreadsheet/ParseExcel

Hi I can't seem to figure out why i keep getting this error. the Spreadsheet::PhaseExcel is installed on 3 servers and is working on only 2... the last one it is installed exactly the same way but I keep getting this error. This is whats odd. If i run this script as a normal user i get... (2 Replies)
Discussion started by: vpundit
2 Replies
All times are GMT -4. The time now is 05:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy