Sponsored Content
Top Forums UNIX for Dummies Questions & Answers count number of rows based on other column values Post 302449192 by Scrutinizer on Sunday 29th of August 2010 03:23:24 AM
Old 08-29-2010
How about something like this:
Code:
$ sort -u infile | cut -d, -f1 | uniq -c
      2 bob
      1 clarissa
      2 david
      2 emelie
      1 tim


Last edited by Scrutinizer; 08-29-2010 at 06:40 PM..
This User Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to assign scores to rows based on column values

Hi, I'm trying to assign a score to each row which will allow me to identify which rows differ. In the example file below, I've used "," to indicate column separators (my actual file has tab separators). In this example, I'd like to identify that row 1 and row 5 are the same, and row 2 and row... (4 Replies)
Discussion started by: auburn
4 Replies

2. UNIX for Dummies Questions & Answers

how to count number of rows and sum of column using awk

Hi All, I have the following input which i want to process using AWK. Rows,NC,amount 1,1202,0.192387 2,1201,0.111111 3,1201,0.123456 i want the following output count of rows = 3 ,sum of amount = 0.426954 Many thanks (2 Replies)
Discussion started by: pistachio
2 Replies

3. Shell Programming and Scripting

how to add the number of row and count number of rows

Hi experts a have a very large file and I need to add two columns: the first one numbering the incidence of records and the another with the total count The input file: 21 2341 A 21 2341 A 21 2341 A 21 2341 C 21 2341 C 21 2341 C 21 2341 C 21 4567 A 21 4567 A 21 4567 C ... (6 Replies)
Discussion started by: juelillo
6 Replies

4. UNIX for Dummies Questions & Answers

Extracting rows from a text file based on numerical values of a column

I have a text file where the second column is a list of numbers going from small to large. I want to extract the rows where the second column is smaller than or equal to 0.0001. My input: rs10082730 9e-08 12 46002702 rs2544081 1e-07 12 46015487 rs1425136 1e-06 7 35396742 rs2712590... (1 Reply)
Discussion started by: evelibertine
1 Replies

5. Shell Programming and Scripting

join rows based on the column values

Hi, Please help me to convert the input file to a new one. input file: -------- 1231231231 3 A 4561223343 0 D 1231231231 1 A 1231231231 2 A 1231231231 4 D 7654343444 2 A 4561223343 1 D 4561223343 2 D the output should be: -------------------- 1231231231 3#1#2 A 4561223343 0 D... (3 Replies)
Discussion started by: vsachan
3 Replies

6. UNIX for Dummies Questions & Answers

Extracting rows from a space delimited text file based on the values of a column

I have a space delimited text file. I want to extract rows where the third column has 0 as a value and write those rows into a new space delimited text file. How do I go about doing that? Thanks! (2 Replies)
Discussion started by: evelibertine
2 Replies

7. UNIX for Dummies Questions & Answers

count number of distinct values in each column with awk

Hi ! input: A|B|C|D A|F|C|E A|B|I|C A|T|I|B As the title of the thread says, I would need to get: 1|3|2|4 I tried different variants of this command, but I don't manage to obtain what I need: gawk 'BEGIN{FS=OFS="|"}{for(i=1; i<=NF; i++) a++} END {for (b in a) print b}' input ... (2 Replies)
Discussion started by: beca123456
2 Replies

8. Shell Programming and Scripting

Choosing rows based on column values

I have a .csv file: A,B,0.6 C,D,-0.7 D,E,0.1 A,E,0.45 D,G, -0.4 I want to select rows based on the values of the 3rd columns such that it is >=0.5 or <= -0.5 Thanks. A,B,0.6 D,G, -0.7 (1 Reply)
Discussion started by: Sanchari
1 Replies

9. Shell Programming and Scripting

UNIX command -Filter rows in fixed width file based on column values

Hi All, I am trying to select the rows in a fixed width file based on values in the columns. I want to select only the rows if column position 3-4 has the value AB I am using cut command to get the column values. Is it possible to check if cut -c3-4 = AB is true then select only that... (2 Replies)
Discussion started by: ashok.k
2 Replies

10. Shell Programming and Scripting

Count number of unique values in each column of array

What is an efficient way of counting the number of unique values in a 400 column by 1000 row array and outputting the counts per column, assuming the unique values in the array are: A, B, C, D In other words the output should look like: Value COL1 COL2 COL3 A 50 51 52... (16 Replies)
Discussion started by: Geneanalyst
16 Replies
HB_STANDBY(1)							 General commands						     HB_STANDBY(1)

NAME
hb_standby - issues a failover request to the cluster manager SYNOPSIS
hb_standby [all|foreign|local|failback] DESCRIPTION
Warning This command is deprecated. It is only suitable for legacy Heartbeat clusters without Pacemaker enabled. In Pacemaker-enabled clusters, the crm(8) shell supports switching individual nodes into standby mode, and replaces hb_standby. /usr/share/heartbeat/hb_standby issues a request to the cluster to move resources from the node where it is invoked, to the other node (if it is currently available). The meaning of the options is relative. This manual assumes the following configuration to be present in /etc/ha.d/haresources: alice drbddisk::r0 Filesystem::/dev/drbd0::/local/groups::ext3 10.0.0.1 smb bob drbddisk::r1 Filesystem::/dev/drbd1::/local/ldap::ext3 10.0.0.2 ldap OPTIONS
The following options are supported: local Migrates any resources that the local node is the preferred node for. When invoked on alice, Samba would be shut down, the IP address 10.0.0.1 would be released, /local/groups would be unmounted, /dev/drbd0 would be placed into the secondary role and bob would take all these services over. When run on bob, OpenLDAP would shut down, 10.0.0.2 would be released, /local/ldap would be unmounted, /dev/drbd1 would be placed into the Secondary role and alice would take over all these services. foreign|failback Migrates any resources that the local node is not the preferred node for. When run on alice, OpenLDAP would shut down, 10.0.0.2 would be released, /local/ldap would be unmounted, /dev/drbd1 would be placed into the Secondary role and bob would take over all these services. When invoked on bob, Samba would be shut down, the IP address 10.0.0.1 would be released, /local/groups would be unmounted, /dev/drbd0 would be placed into the secondary role and alice would take all these services over. all Migrates all resources to the other node. Invoking hb_standby without any options is identical to hb_standby all. CAVEATS
hb_standby is only usable in R1-style configurations (i.e., those configured using the haresources file). SEE ALSO
hb_takeover(1), heartbeat(8), cl_status(1) AUTHORS
Alan Robertson <alanr@unix.sh> hb_standby Guochun Shi <gshi@ncsa.uiuc.edu> man page Florian Haas <florian.haas@linbit.com> man page Heartbeat 3.0.5 November 26, 2009 HB_STANDBY(1)
All times are GMT -4. The time now is 01:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy