Search Results

Search: Posts Made By: sajal.bhatia
7,000
Posted By agama
Yes, that function is unchanged, but it writes...
Yes, that function is unchanged, but it writes the result in column 4, not 1 as column 1 is always the bin (interval) number -- I assume that 1 was a typo.
7,000
Posted By agama
Small tweeks to the original awk to show number...
Small tweeks to the original awk to show number of new IPs in the current bin compared to the previous.


#!/usr/bin/env ksh

awk -v bin_size=${1:-5} '
function dump( )
{
if(...
21,822
Posted By yazu
??? Try: paste -d' ' file1 file2
??? Try:
paste -d' ' file1 file2
7,000
Posted By agama
Have a go with this: #!/usr/bin/env ksh ...
Have a go with this:


#!/usr/bin/env ksh

awk -v bin_size=${1:-5} '
function dump( )
{
if( NR == 1 )
return;
printf( "%3d %3d %3d\n", bin+1, total,...
7,000
Posted By yazu
It works perfectly and it's a very good script (I...
It works perfectly and it's a very good script (I tried to write one but I couldn't). Get your INPUTFILE from stdin like this:
./this_script 1 <INPUTFILE
3,595
Posted By Chubler_XL
OK, try this. It copies the current IPs array to...
OK, try this. It copies the current IPs array to PIPs (previous IPs) once a line is output. This array is used to check each for IPs not in the previous range.

awk -F"[:, ]" ' { now=mktime("2000...
1,053
Posted By Chubler_XL
sed 's/\..*//' inputfile > newfile
sed 's/\..*//' inputfile > newfile
1,053
Posted By jim mcnamara
awk -F '.' '{print $1}' inputfile > newfile
awk -F '.' '{print $1}' inputfile > newfile
5,173
Posted By Scrutinizer
This is a one-liner version of agama's approach...
This is a one-liner version of agama's approach which may speed thing up a little bit.
awk -F: '{t=$1*3600+$2*60+$3} NR>1{printf( "%.6f\n", t-p)}{p=t}' infile
5,173
Posted By agama
There's no check for a clock roll-over, but this...
There's no check for a clock roll-over, but this might get you started:


awk '
{
split( $1, a, ":" )
t = a[1] * 3600;
t += a[2] * 60;...
7,780
Posted By danmero
Using awk awk 'NF{a[$NF]++}END{for(i in...
Using awk
awk 'NF{a[$NF]++}END{for(i in a)print i,a[i]}' file | sort
3,781
Posted By rdcwayx
You can run agama's code directly, no need add it...
You can run agama's code directly, no need add it in awk command again.

awk -v window=${1:-7200} '
{
if( $1 > end_window ) # reached the end of the time window
...
3,781
Posted By agama
This should get you started. You'll have to add...
This should get you started. You'll have to add conversion if you want to allow the user to supply 2 hours rather than 7200 seconds. Not sure how fast this will be, don't have the patience tonight...
Showing results 1 to 13 of 13

 
All times are GMT -4. The time now is 04:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy