We have a program which create sar output files which has a weeks data...
To read file we use sar -f sa15 command which has multiple days data( a weeks data)....we need to only get last 48 hours data and email it to different users....
I guess we can use combination of sar -o or even awk. Please help
Please post:
Operating system and version.
Exact crons which are doing the data collection.
If this is unix, I strongly suspect that you are running "sa1" but not running "sa2" (or running some other way of causing rotation of the sar "sann" data files).
When set up correctly your sar data file for the 15th of the month "sa15" should only contain 24 hours data. Without proper maintenance these files grow and the content becomes meaningless (in your case "sa15" probably contains contaconated data for every 15th of the month rather than consecutive days data).
Beware that "sa2" on many systems only keeps 7 days data and you will need to either change "sa2" (it is a shell script), or write something better that suits your situation, and/or make external provision to save the sar "sann" data files. The "sa2" script also stores a human-readble report of the "sann" files which may or may not be useful.
Well worth planning what information you want from the system then configuring the "sar" package to your requirements.
This sounds suspiciously like homework. And given that you already have a, as of yet uncontested, homework violation chalked up against you, I'm very much inclined to treat this one the same way. Unless you can provide information that indicates otherwise.