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
MOVE(7) 						  PostgreSQL 9.2.7 Documentation						   MOVE(7)

NAME
MOVE - position a cursor SYNOPSIS
MOVE [ direction [ FROM | IN ] ] cursor_name where direction can be empty or one of: NEXT PRIOR FIRST LAST ABSOLUTE count RELATIVE count count ALL FORWARD FORWARD count FORWARD ALL BACKWARD BACKWARD count BACKWARD ALL DESCRIPTION
MOVE repositions a cursor without retrieving any data. MOVE works exactly like the FETCH command, except it only positions the cursor and does not return rows. The parameters for the MOVE command are identical to those of the FETCH command; refer to FETCH(7) for details on syntax and usage. OUTPUTS
On successful completion, a MOVE command returns a command tag of the form MOVE count The count is the number of rows that a FETCH command with the same parameters would have returned (possibly zero). EXAMPLES
BEGIN WORK; DECLARE liahona CURSOR FOR SELECT * FROM films; -- Skip the first 5 rows: MOVE FORWARD 5 IN liahona; MOVE 5 -- Fetch the 6th row from the cursor liahona: FETCH 1 FROM liahona; code | title | did | date_prod | kind | len -------+--------+-----+------------+--------+------- P_303 | 48 Hrs | 103 | 1982-10-22 | Action | 01:37 (1 row) -- Close the cursor liahona and end the transaction: CLOSE liahona; COMMIT WORK; COMPATIBILITY
There is no MOVE statement in the SQL standard. SEE ALSO
CLOSE(7), DECLARE(7), FETCH(7) PostgreSQL 9.2.7 2014-02-17 MOVE(7)