interval based count


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting interval based count
# 1  
Old 12-03-2011
interval based count

Hi,

I have a file with 4 million rows. what i am trying to achieve is for every 1000 interval count the number of rows and display it

i/p

Code:
12
200
400
750
1000
1500
1800
2200
2345
2600
2896
3020
3400
3689
3977

o/p

Code:
1-1000  5
1001-2000   2
2001-3000   4
3001-4000   4

Thanks,
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to count based on date

i have a file with data as follows: 3/23/2014 22:01:18 1 3/23/2014 22:01:47 0 3/23/2014 22:03:35 0 3/23/2014 22:04:50 1 3/24/2014 1:16:41 0 3/24/2014 1:18:00 0 3/24/2014 1:18:36 0 3/24/2014 1:21:46 0 3/25/2014 13:00:31 1 3/25/2014 13:00:54 0 3/25/2014 13:13:09 0 3/25/2014 13:14:15 0... (2 Replies)
Discussion started by: ssk250
2 Replies

2. Shell Programming and Scripting

Count occurences based on interval

Hi, I have a file which has 4500 entries 10000 9880 9800 8700 8200 ... ..... ... ... ... ... ... ... ... 50 (1 Reply)
Discussion started by: Diya123
1 Replies

3. Shell Programming and Scripting

Value Increment based on count

Hi All, I have source file x.txt 0001|0003 0031|0031 0045|0049 My desired output should be: y.txt 0001 0002 0003 0031 0045 0046 0047 (11 Replies)
Discussion started by: kmsekhar
11 Replies

4. UNIX for Dummies Questions & Answers

count values based on contents of another file

Hello, I have two files as shown below: test1 678 679 689 690 710 test2 1 678 654 800 676 791 689 900 I want to get a count of lines from test2 whose columns bound the values in test1 I tried running the code below; however am getting wrong results. (3 Replies)
Discussion started by: Gussifinknottle
3 Replies

5. Shell Programming and Scripting

compare the interval of 2 numbers of input2with interval of several numbers of input1

Help plz Does any one have any idea how to compare interval ranges of 2 files. finding 1-4 (1,2,3,4) of input2 in input1 of same key "a" values (5-10, 30-40, 45-60, 80-90, 100-120 ). Obviously 1-4 is not one of the range with in input1 a. so it should give out of range. finding 30-33(31,32,33)... (1 Reply)
Discussion started by: repinementer
1 Replies

6. Shell Programming and Scripting

Need to search and replace based on character count

Hi, I wanted to add a newline character after every 100 characters in a file using a awk or shell without reading each line of the file. I want to run a command on the complete file. This does based on a string but i want to add a new line after every 100 characters ir-respective of the... (3 Replies)
Discussion started by: vijaykrc
3 Replies

7. Shell Programming and Scripting

Dynamic Variable Based on Count

I'm trying to assign variables that include the current value of a count, but I can't seem to get it working... this script is incomplete, but some guidance on how to use a dynamic variable would be helpful: Sample Input: bash-2.03$ more sg2.txt Results for group6 443 1394 Results for... (3 Replies)
Discussion started by: earnstaf
3 Replies

8. UNIX for Dummies Questions & Answers

sar and iostat recommended interval/count values.

Hi, I got a request from a client to check on their server's cpu, memory and disk utilization. Am planning to use the sar and iostat commands to achieve this. The server is used for sending and receiving messages between the stockbrokers, so I was thinking to run the commands during the market... (9 Replies)
Discussion started by: 60doses
9 Replies

9. Shell Programming and Scripting

Count of files based on date?

Hi Friends, Can anyone help me with this: To get the count of files that are existing in a directory created on a perticular date like in the example (01/08) .(having same pattern for the filename) ex: FileName Creted Date FILE001 01/08/2007 FILE005 ... (6 Replies)
Discussion started by: sbasetty
6 Replies
Login or Register to Ask a Question
SA1(8)								Linux User's Manual							    SA1(8)

NAME
sa1 - Collect and store binary data in the system activity daily data file. SYNOPSIS
/usr/lib64/sa/sa1 [ --boot | interval count ] DESCRIPTION
The sa1 command is a shell procedure variant of the sadc command and handles all of the flags and parameters of that command. The sa1 com- mand collects and stores binary data in the /var/log/sa/sadd file, where the dd parameter indicates the current day. The interval and count parameters specify that the record should be written count times at interval seconds. If no arguments are given to sa1 then a single record is written. The sa1 command is designed to be started automatically by the cron command. OPTIONS
--boot This option tells sa1 that the sadc command should be called without specifying the interval and count parameters in order to insert a dummy record, marking the time when the counters restarts from 0. EXAMPLE
To collect data (including those from disks) every 10 minutes, place the following entry in your root crontab file: 0,10,20,30,40,50 * * * * /usr/lib64/sa/sa1 1 1 -S DISK FILES
/var/log/sa/sadd Indicate the daily data file, where the dd parameter is a number representing the day of the month. AUTHOR
Sebastien Godard (sysstat <at> orange.fr) SEE ALSO
sar(1), sadc(8), sa2(8), sadf(1), sysstat(5) http://pagesperso-orange.fr/sebastien.godard/ Linux FEBRUARY 2012 SA1(8)