Sponsored Content
Full Discussion: Help with data grouping
Top Forums UNIX for Dummies Questions & Answers Help with data grouping Post 302362547 by 793589 on Friday 16th of October 2009 11:52:03 AM
Old 10-16-2009
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:
HTML Code:
name		sex	marital status		children - boy		children - girl		
~~~~		~~~	~~~~~~~~~~~~~~		~~~~~~~~~~~~~~		~~~~~~~~~~~~~~~
patrick		m	married			-			1			
alice		f	single			-			-
joanna		f	married			-			-
max		m	divorce			2			4
hendrik		m	married			1			2
lucy		f	married			-			1
albert		m	single			-			-
apple		f	divorce			-			3
june		f	married			1			-
helen		f	married			-			2
tim		m	single			-			-
wilfred		m	married			-			-
chloe		f	single			-			-
jessica		f	married			2			1
My output:
HTML Code:
name		sex	marital status		children - boy		children - girl		
~~~~		~~~	~~~~~~~~~~~~~~		~~~~~~~~~~~~~~		~~~~~~~~~~~~~~~
patrick		m	married			-			1			
max		m	divorce			2			4
hendrik		m	married			1			2
lucy		f	married			-			1
apple		f	divorce			-			3
june		f	married			1			-
helen		f	married			-			2
jessica		f	married			2			1
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

egrep and grouping

i am using the c shell on solaris. directories i'm working with: ls -1d DIV* DIV_dental/ DIV_ibc/ DIV_ifc/ DIV_index/ DIV_pharm/ DIV_sectionI/ DIV_sectionI-title/ DIV_sectionI-toc/ DIV_sectionII-title/ DIV_sectionII-toc/ DIV_standing/ DIV_standing-toc/ DIV_title/ DIV_vision/ (1 Reply)
Discussion started by: effigy
1 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. Shell Programming and Scripting

Grouping data numbers in a text file into prescribed intervals and count

I have a text file that contains numbers (listed from the smallest to the largest). For ex. 34 817 1145 1645 1759 1761 3368 3529 4311 4681 5187 5193 5199 5417 5682 . . (5 Replies)
Discussion started by: Lucky Ali
5 Replies

4. UNIX for Advanced & Expert Users

grouping lines

Hi all, I have input lines like below: A;100;Paris;City;10;0;0 A;100;Paris;City;0;10;0 A;100;Paris;City in Europe;0;0;20 B;101;London;City;20;0;0 B;101;London;City;0;20;0 B;101;London;City in Europe;0;0;40 I need to group the above lines to: A;100;Paris;City in Europe;10;10;20... (4 Replies)
Discussion started by: andy2000
4 Replies

5. Shell Programming and Scripting

Help with grouping data based on range position

Input file: data_1 1000 1290 data_4 290 234 data_2 1114 1110 data_5 534 999 data_6 900 1050 . . Desired_output_file_1_0_999: data_4 290 234 data_5 534 999 Desired_output_file_2_1000_1999: data_1 1000 1290 data_2 1114 1110 (1 Reply)
Discussion started by: perl_beginner
1 Replies

6. Shell Programming and Scripting

Selective grouping

I have a text file in this format. Group: AAA Notes: IP : 11.11.11.11 #User xxxxxxxxx #Password aaaaaaaaaaaaaaaa Group: AAA Notes: IP : 11.11.11.22 #User yyyyyyyyyyyyy #Password bbbbbbbbbbbbb (8 Replies)
Discussion started by: anil510
8 Replies

7. Shell Programming and Scripting

Grouping

Hi all, I am using following command: perl program.pl input.txt output.txt CUTOFF 3 > groups_3.txt containing program.pl, two files (input.txt, output.txt) and getting output in groups_3.txt: But, I wish to have 30 files corresponding to each CUTOFF ranging from 0 to 30 using the same... (1 Reply)
Discussion started by: bioinfo
1 Replies

8. Shell Programming and Scripting

Name grouping

awk 'FNR==NR {a; next} $NF in a' genes.txt refseq_exons.txt > output.txt I can not figure out how to group the same name in $4 together. Basically, all the SKI together in separate rows and all the TGFB2. Thank you :). chr1 2160133 2161174 SKI chr1 218518675 218520389 TGFB2... (1 Reply)
Discussion started by: cmccabe
1 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

Grouping and counting

Hello, I would like to group/sort a file of records by a particular field and then count how many records belong in that grouping. For example say I have the following data: 1234|"ZZZ"|"Date"|"1"|"Y"|"ABC"|""|AA ABCD|"ZZZ"|"Date"|"1"|"Y"|"ABC"|""|AA EFGH|"ZZZ"|"Date"|"1"|"Y"|"ABC"|""|BB... (14 Replies)
Discussion started by: Nik44
14 Replies
HTML::ElementGlob(3pm)					User Contributed Perl Documentation				    HTML::ElementGlob(3pm)

NAME
HTML::ElementGlob - Perl extension for managing HTML::Element based objects as a single object. SYNOPSIS
use HTML::ElementGlob; $element_a = new HTML::Element 'font', color => 'red'; $element_b = new HTML::Element 'font', color => 'blue'; $element_a->push_content('red'); $element_b->push_content('blue'); $p = new HTML::Element 'p'; $p->push_content($element_a, ' and ', $element_b, ' boo hoo hoo'); # Tag type of the glob is not really relevant unless # you plan on seeing the glob as_HTML() $eglob = new HTML::ElementGlob 'p'; $eglob->glob_push_content($element_a, $element_b); # Alter both elements at once $eglob->attr(size => 5); # They still belong to their original parent print $p->as_HTML; DESCRIPTION
HTML::ElementGlob is a managing object for multiple HTML::Element(3) style elements. The children of the glob element retain their original parental elements and have no knowledge of the glob that manipulates them. All methods that do not start with 'glob_' will be passed, sequentially, to all elements contained within the glob element. Methods starting with 'glob_' will operate on the glob itself, rather than being passed to its foster children. For example, $eglob->attr(size => 3) will invoke attr(size => 3) on all children contained by $eglob. $eglob->glob_attr(size => 3), on the other hand, will set the attr attribute on the glob itself. The tag type passed to HTML::Element::Glob is largely irrrelevant as far as how methods are passed to children. However, if you choose to invoke $eglob->as_HTML(), you might want to pick a tag that would sensibly contain the globbed children for debugging or display purposes. The 'glob_*' methods that operate on the glob itself are limited to those available in an HTML::Element(3). All other methods get passed blindly to the globbed children, which can be enhanced elements with arbitrary methods, such as HTML::ElementSuper(3). Element globs can contain other element globs. In such cases, the plain methods will cascade down to the leaf children. 'glob_*' methods, of course, will not be propogated to children globs. You will have to rely on glob_content() to access those glob children and access their 'glob_*' methods directly. REQUIRES
HTML::ElementSuper(3) AUTHOR
Matthew P. Sisk, <sisk@mojotoad.com> COPYRIGHT
Copyright (c) 1998-2010 Matthew P. Sisk. All rights reserved. All wrongs revenged. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
HTML::Element(3), HTML::ElementSuper, HTML::ElementRaw, HTML::Element::Table(3), perl(1). perl v5.10.1 2010-06-09 HTML::ElementGlob(3pm)
All times are GMT -4. The time now is 02:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy