Sponsored Content
Top Forums Shell Programming and Scripting Grouping data numbers in a text file into prescribed intervals and count Post 302387133 by alister on Thursday 14th of January 2010 02:41:28 PM
Old 01-14-2010
Hello. My name is Alister and I have a sickness. Sometimes I can't help but revisit inconsequential, properly functioning commands to make them a tiny bit shorter. Smilie

Code:
awk '{while ($1>=t*w) t++; A[t]++} END {for (i=1;i<=t;i++) print i*w"\t"(A[i]+0)}' w=10000 data

As a bonus, the interval's width can be easily modified on the command line.

Cheers,
alister
This User Gave Thanks to alister For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grouping of numbers with script

Suppose u have a file 2 4 6 11 22 13 23 43 12 4 33 31 45 then u want a output like 0-10 4 10-20 3 20-30 2 30-40 2 40-50 2 (2 Replies)
Discussion started by: cdfd123
2 Replies

2. Shell Programming and Scripting

Grouping and summing data through unix

Hi everyone, I need a help on Unix scripting. I have a file is like this Date Amt 20071205 10 20071204 10 20071203 200 20071204 300 20071203 400 20071205 140 20071203 100 20071205 100... (1 Reply)
Discussion started by: pcharanraj
1 Replies

3. UNIX for Dummies Questions & Answers

Help with data grouping

Hi all, I have a set data as shown below, and i would like to eliminate the name that no children - boy and girl. What is the appropriate command can i use(other than grep)? Please assist... My input: name sex marital status children - boy children - girl ... (3 Replies)
Discussion started by: 793589
3 Replies

4. Shell Programming and Scripting

count numbers of matching rows and replace its value in another file

Hello all, can you help me in this problem, assume We have two txt file (file_1 and file_3) one is file_1 contains the data: a 0 b 1 c 3 a 7 b 4 c 5 b 8 d 6 . . . . and I need to count the lines with the matching data (a,b,..) and print in new file called file_2 such as the... (4 Replies)
Discussion started by: GoldenFalcon10
4 Replies

5. Shell Programming and Scripting

Divide numbers into intervals

divide input values into specified number (-100 or -200) according to the key (a1 or a2 ....) For ex: if we give -100 in the command line it would create 100 number intervals (1-100, 100-200, 200-300) untill it covers the value 300 in a1. Note: It should work the same even with huge numbers... (3 Replies)
Discussion started by: ruby_sgp
3 Replies

6. Shell Programming and Scripting

Remove a block of Text at regular intervals

Hello all, I have a text files that consists of blocks of text. Each block of text represents a set of Cartesian coordinates for a molecule. Each block of text starts with a line that has a only a number, which is equal to the total number of atoms in the molecule. After this number is a line... (15 Replies)
Discussion started by: marcozd
15 Replies

7. UNIX for Dummies Questions & Answers

Extracting lines from a text file based on another text file with line numbers

Hi, I am trying to extract lines from a text file given a text file containing line numbers to be extracted from the first file. How do I go about doing this? Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies

8. Shell Programming and Scripting

Count column data in a text file

I have a text file that has the following column data: 0.007 0.005 0.004 0.007 How do i output the total sum of the data above? (6 Replies)
Discussion started by: alegnagrp
6 Replies

9. Shell Programming and Scripting

Yearly Grouping of Data

I need some logic that would help to group up some records that fall between two dates: Input Data COL_1 COL_2 COL_3 COL_4 COL_5 COL_6 COL_7 COL_8 COL_9 COL_10 COL_11 COL_12 C ABC ABCD 3 ZZ WLOA 2015-12-01 2015-12-15 975.73 ZZZ P 147018.64 C ABC ... (3 Replies)
Discussion started by: Ads89
3 Replies

10. Shell Programming and Scripting

Script Shell: Count The sum of numbers in a file

Hi all; Here is my file: V1.3=4 V1.4=5 V1.1=3 V1.2=6 V1.3=6 Please, can you help me to write a script shell that counts the sum of values in my file (4+5+3+6+6) ? Thank you so much for help. Kind regards. (3 Replies)
Discussion started by: chercheur111
3 Replies
ipmidetectd(8)							    ipmidetectd 						    ipmidetectd(8)

NAME
ipmidetectd - IPMI node detection monitoring daemon SYNOPSIS
ipmidetectd [OPTION...] DESCRIPTION
The ipmidetectd daemon regularly sends out IPMI pings to determine if nodes have functioning IPMI interfaces or not. It is primarily used to determine those nodes in the cluster that are not functioning properly, allowing IPMI commands to be executed across the cluster faster by skipping those nodes that would automatically timeout. The ipmidetectd daemon must be configured using the ipmidetectd configuration file. Until hosts to be pinged are configured, ipmidetectd will not function properly. See the ipmidetectd.conf(5) manpage for additional information. OPTIONS
-h, --help Output help -v, --version Output version ERRORS
Errors are logged to syslog. FILES
/etc/freeipmi//ipmidetectd.conf REPORTING BUGS
Report bugs to <freeipmi-users@gnu.org> or <freeipmi-devel@gnu.org>. COPYRIGHT
Copyright (C) 2007-2012 Lawrence Livermore National Security, LLC. Copyright (C) 2007 The Regents of the University of California. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. SEE ALSO
ipmidetectd.conf(5) http://www.gnu.org/software/freeipmi/ ipmidetectd 1.1.5 2012-06-15 ipmidetectd(8)
All times are GMT -4. The time now is 03:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy