Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Search and count a unique string Post 302885901 by a_bahreini on Wednesday 29th of January 2014 03:58:34 PM
Old 01-29-2014
Thanks Yoda, it worked

---------- Post updated 01-29-14 at 03:58 PM ---------- Previous update was 01-28-14 at 07:29 PM ----------

Hey Yoda,
Sorry again but I have another issue now. For each line, I want the counts of the lines which have similar values in the 1st and 2nd column. Let's say I have a file like this:
Code:
2	131
2	131
3	131
4	150	
4	160
x	200
x	200

I need it to be reported as follows:
Code:
2	131	2
2	131	2
3	131	1
4	150	1	
4	160	1
x	200	2
x	200	2

I really appreciate if you solve this for me.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

count the number of files which have a search string, but counting the file only once

I need to count the number of files which have a search string, but counting the file only once if search string is found. eg: File1: Please note that there are 2 occurances of "aaa" aaa bbb ccc aaa File2: Please note that there are 3 occurances of "aaa" aaa bbb ccc... (1 Reply)
Discussion started by: sudheshnaiyer
1 Replies

2. Shell Programming and Scripting

How to count unique strings

How do I count the total number of unique strings from a file using Perl? Any help is appreciated.. (6 Replies)
Discussion started by: my_Perl
6 Replies

3. Shell Programming and Scripting

get part of file with unique & non-unique string

I have an archive file that holds a batch of statements. I would like to be able to extract a certain statement based on the unique customer # (ie. 123456). The end for each statement is noted by "ENDSTM". I can find the line number for the beginning of the statement section with sed. ... (5 Replies)
Discussion started by: andrewsc
5 Replies

4. Shell Programming and Scripting

Search for a pattern in a String file and count the occurance of each pattern

I am trying to search a file for a patterns ERR- in a file and return a count for each of the error reported Input file is a free flowing file without any format example of output ERR-00001=5 .... ERR-01010=10 ..... ERR-99999=10 (4 Replies)
Discussion started by: swayam123
4 Replies

5. Shell Programming and Scripting

Search several string and convert into a single line for each search string using awk command AIX?.

I need to search the file using strings "Request Type" , " Request Method" , "Response Type" and by using result set find the xml tags and convert into a single line?. below are the scenarios. Cat test Nov 10, 2012 5:17:53 AM INFO: Request Type Line 1.... (5 Replies)
Discussion started by: laknar
5 Replies

6. Shell Programming and Scripting

awk to count using each unique value

Im looking for an awk script that will take the unique values in column 5, then print and count the unique values in column 6. CA001011500 11111 11111 -9999 201301 AAA CA001012040 11111 11111 -9999 201301 AAA CA001012573 11111 11111 -9999 201301 BBB CA001012710 11111 11111 -9999 201301... (4 Replies)
Discussion started by: ncwxpanther
4 Replies

7. Shell Programming and Scripting

Count occurrence of column one unique value having unique second column value

Hello Team, I need your help on the following: My input file a.txt is as below: 3330690|373846|108471 3330690|373846|108471 0640829|459725|100001 0640829|459725|100001 3330690|373847|108471 Here row 1 and row 2 of column 1 are identical but corresponding column 2 value are... (4 Replies)
Discussion started by: angshuman
4 Replies

8. Shell Programming and Scripting

Print count of unique values

Hello experts, I am converting a number into its binary output as : read n echo "obase=2;$n" | bc I wish to count the maximum continuous occurrences of the digit 1. Example : 1. The binary equivalent of 5 = 101. Hence the output must be 1. 2. The binary... (3 Replies)
Discussion started by: H squared
3 Replies

9. UNIX for Beginners Questions & Answers

Count unique words

Dear all, I would like to know how to list and count unique words in thousands number of text files. Please help me out thanks in advance (9 Replies)
Discussion started by: imranrasheedamu
9 Replies

10. UNIX for Beginners Questions & Answers

Count unique column

Hello, I am trying to count unique rows in my file based on 4 columns (2-5) and to output its frequency in a sixth column. My file is tab delimited My input file looks like this: Colum1 Colum2 Colum3 Colum4 Coulmn5 1.1 100 100 a b 1.1 100 100 a c 1.2 200 205 a d 1.3 300 301 a y 1.3 300... (6 Replies)
Discussion started by: nans
6 Replies
YPSERV(8)						       NIS Reference Manual							 YPSERV(8)

NAME
ypserv - NIS Server SYNOPSIS
/usr/sbin/ypserv [-d [path]] [-p port] DESCRIPTION
The Network Information Service (NIS) provides a simple network lookup service consisting of databases and processes. The databases are gdbm files in a directory tree rooted at /var/yp. The ypserv daemon is typically activated at system startup. ypserv runs only on NIS server machines with a complete NIS database. On other machines using the NIS services, you have to run ypbind as client or under Linux you could use the libc with NYS support. ypbind must run on every machine which has NIS client processes; ypserv may or may not be running on the same node, but must be running somewhere on the network. On startup ypserv parses the file /etc/ypserv.conf. OPTIONS
-d, --debug [path] Causes the server to run in debugging mode. Normally, ypserv reports only errors (access violations, dbm failures) using the syslog(3) facility. In debug mode, the server does not background itself and prints extra status messages to stderr for each request that it revceives. path is an optionally parameter. ypserv is using this directory instead of /var/yp -p, --port port ypserv will bind itself to this port. This makes it possible to have a router filter packets to the NIS ports, so that access to the NIS server from hosts on the Internet can be restricted. -v, --version Prints the version number SECURITY
In general, any remote user can issue an RPC to ypserv and retrieve the contents of your NIS maps, if he knows your domain name. To prevent such unauthorized transactions, ypserv supports a feature called securenets which can be used to restrict access to a given set of hosts. At startup ypserv will attempt to load the securenets information from a file called /var/yp/securenets . This file contains entries that consist of a netmask and a network pair separated by white spaces. Lines starting with "#" are considered to be comments. A sample securenets file might look like this: # allow connections from local host -- necessary host 127.0.0.1 # same as 255.255.255.255 127.0.0.1 # # allow connections from any host # on the 131.234.223.0 network 255.255.255.0 131.234.223.0 # allow connections from any host # between 131.234.214.0 and 131.234.215.255 255.255.254.0 131.234.214.0 If ypserv receives a request from an address that fails to match a rule, the request will be ignored and a warning message will be logged. If the /var/yp/securenets file does not exist, ypserv will allow connections from any host. In the /etc/ypserv.conf you could specify some access rules for special maps and hosts. But it is not very secure, it makes the life only a little bit harder for a potential hacker. If a mapname doesn't match a rule, ypserv will look for the YP_SECURE key in the map. If it exists, ypserv will only allow requests on a reserved port. For security reasons, ypserv will only accept ypproc_xfr requests for updating maps from the same master server as the old one. This means, you have to reinstall the slave servers if you change the master server for a map. BUGS
Sending the signal SIGHUP to the server can lead to a deadlock or crash. FILES
/etc/ypserv.conf configuration file. /var/yp/securenets which hosts are allowed to contact ypserv. SEE ALSO
domainname(1), ypcat(1), ypmatch(1), ypserv.conf(5), netgroup(5), makedbm(8), revnetgroup(8), ypinit(8), yppoll(8), yppush(8), ypset(8), ypwhich(8), ypxfr(8), rpc.ypxfrd(8) The Network Information Service (NIS) was formerly known as Sun Yellow Pages (YP). The functionality of the two remains the same; only the name has changed. The name Yellow Pages is a registered trademark in the United Kingdom of British Telecommunications plc, and may not be used without permission. AUTHOR
ypserv was written by Peter Eriksson <pen@lysator.liu.se>. Thorsten Kukuk <kukuk@linux-nis.org> added support for master/slave server and is the new Maintainer. NIS Reference Manual 01/27/2010 YPSERV(8)
All times are GMT -4. The time now is 11:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy