I'm creating a script that goes through some csv files (output from sar) trying to get some statistics on system performance. This is the code I have so far:
The input files have a header line which accounts for the "NR !=1" and "(NR - 1)".
What I need to do is normalise the data working out the 90th and 95th percentile (I haven't quite got to the math part yet - I'm going to try and calculate the cumulative frequency first... ). So what I believe I need to do next is sort my array - but I don't know how many elements are stored in it. Can anyone tell me how to do this?
Some example output here (from just one input file):
Can you explain it to me because I'm a little confused... I can't understand why it works at any other time apart from the first pass - when the variable per[$10] is equal to one...
You're completely right vgersh99 ,but i thought the other piece was more clear for this particular case.
pondlife , you 're using an associative array ,where the index is the 10th element of your input and its value is a counter ,the number of times that the element is repeated.
Each element of the index is unique , so the first time you add a new entry to the array (new index) its counter value wil be 1
On the other hand if the index exits the only variation will be the increase of the value of the counter so:
finally we can say that:
Or:
indicates that a new element was added to the array.
this thread is a continuation from previous thread
https://www.unix.com/shell-programming-and-scripting/223901-split-big-file-into-multiple-files-based-first-four-characters.html
..I am using awk to split file and I have a syntax error while executing the below code
I am using AIX 7.2... (4 Replies)
Hello All,
Can you please help me with the below.
#!/bin/bash
ARR="No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5 EXTRACT_DT:30-SEP-12 VER_NUM:1"
ARR="No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5... (14 Replies)
INPUT SAMPLE
Symmetrix ID : 000192601507
Masking View Name : TS00P22_13E_1
Last updated at : 05:10:18 AM on Tue Mar 22,2011
Initiator Group Name : 10000000c960b9cd
Host Initiators
{
WWN : 10000000c960b9cd
}
Port Group Name :... (8 Replies)
Hi all,
I would like to compare a column in one file to a column in another file and when there is a match it prints the first column and the corresponding second column. Example
File1
ABA
ABC
ABE
ABF
File 2
ABA 123
ABB 124
ABD 125
ABC 126
So what I would like printed to a... (6 Replies)
Hi,
I have a text file that is around 7Gb which is basically a matrix of numbers (FS is a space and RS is \n). I need the most efficient way of plucking out a number from a specified row and column in the file.
For example, for the value at row 15983, col 26332, I'm currently I'm using:
... (1 Reply)
Hi experts.
In one thread i have asked you how to grep the string from the below sample file-
Unfortunately the script did not gave proper output (it missed many strings). It happened may be i did gave you the proper contents of the file
That was the script-
"$ perl -00nle'print join... (13 Replies)
Morning guys. Another day another question. :rolleyes:
I am knocking up a script to pull some data from a file. The problem is the file is very big (up to 1 gig in size), so this solution:
for results in `grep "^\
... works, but takes ages (we're talking minutes) to run. The data is held... (8 Replies)
I am facing some strange problem.
I know, there is only one record in a file 'test.txt' which starts with 'X'
I ensure that with following command,
awk /^X/ test.txt | wc -l
This gives me output = '1'.
Now I take out this record out of the file, as follows :
awk /^X/ test.txt >... (1 Reply)