Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Need to filter data from a file Post 302538426 by erora on Wednesday 13th of July 2011 02:14:53 AM
Old 07-13-2011
Need to filter data from a file

Hi,
I have a file with hundreds of records.
There are four fields on each line, separated by semicolons.
Name
Height (meters)
Country
Continent (Africa,Asia,Europe,North America,Oceania,South
America,The Poles)

I need to Write the command to find display how many mountains appear in
the list on each continent , like this:
30 Africa
144 Asia
91 Europe
163 North America
11 Oceania
116 South America
3 The Poles

I know I can count it by using Grep and filters but I will need one command per continent. How do I use a single command to list down the output in this format?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

filter data

Hi I have two files and their names are donotcall.txt, filter_it.txt. I want output.txt file with all data that is in filter_it.txt file but not in donotcall.txt. Can anybody help me to write 1-2 lines unix code for this. donotcall.txt contains following data. Each row represent phone... (3 Replies)
Discussion started by: deep.singh
3 Replies

2. Windows & DOS: Issues & Discussions

Filter data from text file

Hi All We have got a text file, which has data dumped from 60 tables. From these 60 tables of data we need data from 4 tables only. I tried assigning line numbers to filter out data, but it is not working as intended. below is the sample file ----Table1----- 3,dfs,43,df 4,sd,5,edd... (18 Replies)
Discussion started by: b_sri
18 Replies

3. UNIX for Dummies Questions & Answers

Using input file to filter data from another file

I have a data file: abc Text Text Text Unique Text 123 Text word Line Unique Text fgh Text data Line Unique Text 789 Text Text Line Unique Text 543 Text Text Data Unique Text and a filter file 123 789 I want to extract out from the data file the two records that contain the keys... (1 Reply)
Discussion started by: tumblez
1 Replies

4. Shell Programming and Scripting

extract data from a data matrix with filter criteria

Here is what old matrix look like, IDs X1 X2 Y1 Y2 10914061 -0.364613333 -0.362922333 0.001691 -0.450094667 10855062 0.845956333 0.860396667 0.014440333 1.483899333... (7 Replies)
Discussion started by: ssshen
7 Replies

5. Shell Programming and Scripting

Shell script to read lines in a text file and filter user data

hi all, I have this file with some user data. example: $cat myfile.txt FName|LName|Gender|Company|Branch|Bday|Salary|Age aaaa|bbbb|male|cccc|dddd|19900814|15000|20| eeee|asdg|male|gggg|ksgu|19911216||| aara|bdbm|male|kkkk|acke|19931018||23| asad|kfjg|male|kkkc|gkgg|19921213|14000|24|... (4 Replies)
Discussion started by: srimal
4 Replies

6. UNIX for Advanced & Expert Users

filter last 24 hour data and put in new file

i have file server 1 (filesvr01acess.log) and disc server 1 (discsvr01acess.log) in unix box(say ip adress of the box 10.39.66.81) Similiarly i have file server 2 (filesvr01acess.log) and disc server 2(discsvr01acess.log) in another unix box(say ip adress of the box 10.39.66.82). Now my... (1 Reply)
Discussion started by: nripa1
1 Replies

7. Shell Programming and Scripting

How to filter required data from file using bash script?

Hi All , I have one file like below , Owner name = abu2-kxy-m29.hegen.app Item_id = AX1981, special_id = *NULL*, version = 1 Created = 09/01/2010 12:56:56 (1283389016) Enddate = 03/31/2011 00:00:00 (1301554800) From the above file I need to get the output in the below format ,i need... (3 Replies)
Discussion started by: gnanasekar_beem
3 Replies

8. Shell Programming and Scripting

Filter a .kml file (xml) with data set from text file

I have a .kml file. So I want filter the .kml to get only the tags that have this numeric codes that they are in a text file 11951 11952 74014 11964 11965 11969 11970 11971 11972 60149 74018 74023 86378 11976 11980 11983 11984 11987 (5 Replies)
Discussion started by: pcoj33
5 Replies

9. Shell Programming and Scripting

How to filter out data file...?

Hi... I would like to filter out my data file....in two different way 1st way is like this, I will take one example..here... The script should ask like this. Enter min value in first column Enter max value in first column Enter min value in second column Enter max value in... (5 Replies)
Discussion started by: nex_asp
5 Replies

10. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies
IP::Authority(3)					User Contributed Perl Documentation					  IP::Authority(3)

NAME
IP::Authority - fast lookup of authority by IP address SYNOPSIS
use IP::Authority; my $reg = IP::Authority->new(); print $reg->inet_atoauth('212.67.197.128') ." "; print $reg->inet_atoauth('www.slashdot.org') ." "; DESCRIPTION
Historically, the former InterNIC managed (under the auspices of IANA) the allocation of IP numbers to ISPs and other organizations. This changed somewhat when the Regional Internet Registry system was started, with the creation of three (and later, four) Regional Internet Registries (RIRs) around the world, each managing the allocation of IP addresses to organizations within differing physical areas (see also RFC2050). This means that there is no central whois database for IP numbers. This module allows the user to lookup the RIR who has authority for a particular IP address. After finding out the authority for an IP address, it is possible to use the authority's whois server to lookup the netblock owner. CONSTRUCTOR
The constructor takes no arguments. use IP::Authority; my $reg = IP::Authority->new(); OBJECT METHODS
All object methods are designed to be used in an object-oriented fashion. $result = $object->foo_method($bar,$baz); Using the module in a procedural fashion (without the arrow syntax) won't work. $auth = $reg->inet_atoauth(HOSTNAME) Takes a string giving the name of a host, and translates that to an two-letter string representing the regional Internet registry that has authority of that IP address: AR = ARIN (North America) RI = RIPE (Europe) LA = LACNIC (Latin America) AP = APNIC (Asia-Pacific) AF = AFRINIC (Africa and Indian Ocean) IA = IANA (see RFC3330) Takes arguments of both the 'rtfm.mit.edu' type and '18.181.0.24'. If the host name cannot be resolved, returns undef. If the resolved IP address is not contained within the database, returns undef. For multi-homed hosts (hosts with more than one address), the first address found is returned. $auth = $reg->inet_ntoauth(IP_ADDRESS) Takes a string (an opaque string as returned by Socket::inet_aton()) and translates it into a two-letter string representing the regional Internet registry that has authority of that IP address: AR = ARIN (North America) RI = RIPE (Europe) LA = LACNIC (Latin America) AP = APNIC (Asia-Pacific) AF = AFRINIC (Africa and Indian Ocean) IA = IANA (see RFC3330) If the IP address is not contained within the database, returns undef. $t = $reg->db_time() Returns the creation date of the database, measured as number of seconds since the Unix epoch (00:00:00 GMT, January 1, 1970). Suitable for feeding to "gmtime" and "localtime". BUGS
/LIMITATIONS Only works with IPv4 addresses and ASCII hostnames. SEE ALSO
IP::Country - fast lookup of country codes from IP address. <http://www.apnic.net> - Asia-Pacific <http://www.ripe.net> - Europe <http://www.arin.net> - North America <http://www.lacnic.net> - Latin America <http://www.afrinic.net> - Africa and Indian Ocean COPYRIGHT
Copyright (C) 2002-2005 Nigel Wetters Gourlay. All Rights Reserved. NO WARRANTY. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Some parts of this software distribution are derived from the APNIC, LACNIC, ARIN, AFRINIC and RIPE databases (copyright details below). I am not a lawyer, so please direct questions about the RIR's licenses to them, not me. APNIC conditions of use The files are freely available for download and use on the condition that APNIC will not be held responsible for any loss or damage arising from the application of the information contained in these reports. APNIC endeavours to the best of its ability to ensure the accuracy of these reports; however, APNIC makes no guarantee in this regard. In particular, it should be noted that these reports seek to indicate the country where resources were first allocated or assigned. It is not intended that these reports be considered as an authoritative statement of the location in which any specific resource may currently be in use. ARIN database copyright Copyright (c) American Registry for Internet Numbers. All rights reserved. The ARIN WHOIS data is for Internet operational or technical research purposes pertaining to Internet operations only. It may not be used for advertising, direct marketing, marketing research, or similar purposes. Use of the ARIN WHOIS data for these activities is explicitly forbidden. ARIN requests to be notified of any such activities or suspicions thereof. RIPE database copyright The information in the RIPE Database is available to the public for agreed Internet operation purposes, but is under copyright. The copyright statement is: "Except for agreed Internet operational purposes, no part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, recording, or otherwise, without prior permission of the RIPE NCC on behalf of the copyright holders. Any use of this material to target advertising or similar activities is explicitly forbidden and may be prosecuted. The RIPE NCC requests to be notified of any such activities or suspicions thereof." LACNIC database copyright Copyright (c) Latin American and Caribbean IP address Regional Registry. All rights reserved. AFRINIC copyright Seems to be the RIPE copyright. I'm sure they'll correct this in due course. perl v5.12.1 2006-04-06 IP::Authority(3)
All times are GMT -4. The time now is 03:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy