Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script to strip headers from files

Status
Not open for further replies.

ianf

MIS
Mar 23, 2001
183
GB
Hi,
First post to this forum, not a natural born programmer !(but trying hard)

I have a number of different files generated various unix level and db level diagnostics. I want to run a cron job that periodically adds to the end of these files up to a maximum file size and from there does a round-robin, deleting the overspill.

The aim of the game is to produce performance stats that can be graphed over time to track down a bottleneck.

I know a very little scripting. I have the commands that I want to run and at the minute I have them outputting to single files which are then tar.gzipped with the date as a filename suffix to identify them.

I know the number of lines from each command output that need to be stripped.

From what I understand awk is probably the way to strip the headers before catting to the existing files. Is this right ? If so, how do I do this ?

(any hints on the round-robin are also very gratefully recieved !)

Many Thanks in advance
Ian

"IF" is not a word it's a way of life
 
If there is not an arbitrary limit to the
header length then you can use awk or sed.
A sample file would be helpful.

Otherwise if the same number of lines from each file needs to saved, minus the header
then a head or tail (-n??) will do the job
more easily.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top