How to calculate the entropy of a single directory that contains many files
Hello,
I'm new member of shell scripting and i face some difficulties. To begin, i try to write an algorithm that calculate from one directory containing nfdump files (288) the entropy of one day 24hours. Each of the file is 5 min interval
(nfdump -r nfcapd.200908250000 -s srcip) 1st
(nfdump -r nfcapd.200908250005 -s srcip) 2nd
(nfdump -r nfcapd.200908250010 -s srcip) 3rd
...
(nfdump -r nfcapd.200908252350 -s srcip) last
taking the flows (first 10) to calculate the entropy of the first 5 min interval i did it (i hope so in the right way) and i took the results of the 1st 5 min interval entropy. the code that i have written is:
I used the shannon entropy formula for this.
My main problem now is how to make a matrix -array of all 288 files of 5 min interval and how is possible to combine the above algorithm with the matrix? Please if someone knows how to do this just to give me some help - advise
Thanks
Hi,
I have written one script to calculate total space of all file in one directory, ignoring subdirectory, it works fine.
Now, I've been trying to calculate all files which includes files in any subdirectories.
I use recursive function to do this, but it can work only if there is only one... (4 Replies)
hi
sorry for grammar mistakes but i am writting these fro tablet and am not realy used to ot so well yet....
i am in the middle of doing work here and hope some1 ca answear my question asap please :-)
How to calculate the amount of internal fragmentation using script.
cd directory ...... (6 Replies)
Hi,
Is there a way to find all the files from a specific location and then zip them into a single file, even if they are in multiple directories? (3 Replies)
i have below list of files in a directory.
/root/admin/files/file1.txt
/root/admin/files/file2.txt
/root/admin/files/file3.txt
/root/admin/files/pattern.txt
/root/admin/files/server.txt
i need combine the above text files in the below sequence,
file1.txt, pattern.txt,server.txt =>... (8 Replies)
I am trying to do the following task :
export ENV=aaa
export ENV_PATH=$(cd /apps | ls | grep $ENV)
However, it's not working. What's the way to change to directory and search some file in that directory in single command
Please help. (2 Replies)
Hi,
I have 2 csv/txt files with single columns. I am trying to merge them using paste, but its not working..
output3.csv:
flowerbomb
everlon-jewelry
sofft
steve-madden
dolce-gabbana-watchoutput2.csv:
http://www1.abc.com/cms/slp/2/Flowerbomb
http://www1.abc.com/cms/slp/2/Everlon-Jewelry... (5 Replies)
I am trying to use awk to calculate the average of all lines in $2 for every file in a directory. The below bash seems to do that, but I cannot figure out how to capture the string before the _ as the output file name and have it be tab-delimeted. Thank you :).
Filenames in... (3 Replies)
I need to copy a complete directory structure into a new location. But I want to have all files copied into one directory and leave out the directory structure. So all files must be placed in one directory. (4 Replies)
I have multiple files test1, test2, test3 etc. I want to move to a different directory with ABC_ prefixed to every file and and current dat time as postfix using a single command. (I will be using this is sftp with ! (command for local server).
I have tried the following but it gives error
... (5 Replies)
Discussion started by: Soham
5 Replies
LEARN ABOUT FREEBSD
random_harvest
RANDOM_HARVEST(9) BSD Kernel Developer's Manual RANDOM_HARVEST(9)NAME
random_harvest -- gather entropy from the kernel for the entropy device
SYNOPSIS
#include <sys/types.h>
#include <sys/random.h>
void
random_harvest(void *entropy, u_int size, u_int bits, u_int frac, enum esource source);
DESCRIPTION
The random_harvest() function is used by device drivers and other kernel processes to pass data that is considered (at least partially) sto-
chastic to the entropy device.
The caller should pass a pointer (to no more than 16 bytes) of the ``random'' data in entropy. The argument size contains the number of
bytes pointed to. The caller should very conservatively estimate the number of random bits in the sample, and pass this in bits or frac. If
the estimated number of bits per sample is an integer, then bits is used, and frac is 0. Otherwise, for low-entropy samples, ``fractional''
entropy can be supplied in frac. (This is considered to be frac / 1024 bits of entropy.) The source is chosen from RANDOM_WRITE,
RANDOM_KEYBOARD, RANDOM_MOUSE, RANDOM_NET and RANDOM_INTERRUPT, and is used to indicate the source of the entropy.
Interrupt harvesting has been simplified for the kernel programmer. If a device driver registers an interrupt handler with BUS_SETUP_INTR(9)
or bus_setup_intr(9), then it is only necessary to include the INTR_ENTROPY bit in the flags argument to have that interrupt source be used
for entropy harvesting.
SEE ALSO random(4), BUS_SETUP_INTR(9)AUTHORS
The FreeBSD random(4) entropy device and supporting documentation was written by Mark R V Murray.
BSD February 6, 2002 BSD