Sponsored Content
Top Forums Shell Programming and Scripting Uniq not doing what I want it to Post 302568809 by MaindotC on Friday 28th of October 2011 09:35:25 AM
Old 10-28-2011
Uniq not doing what I want it to

I have a master list of servers. I also have a list of servers I'm not supposed to touch. I'm trying to filter out the list servers that I'm not supposed to touch from the master list of servers, so I will have a "master list of servers I can touch". When I try to filter these I'm not getting the desired result:

Code:
for i in $(cat dont_touch_list);do grep -iv $i master_list; done | uniq > master_touch_list

What this is doing, it appears, is echoing the master_list into the master_touch_list for each interation of the dont_touch_list. What am I doing wrong?
 

10 More Discussions You Might Find Interesting

1. HP-UX

help on UniQ

All, Can anybody provide me the links to the documentation on UniQPrint? I need to prepare some documents to help my co-workers to learn UniQPrint. Regards, Vishal (0 Replies)
Discussion started by: vishal_ranjan
0 Replies

2. Shell Programming and Scripting

who - uniq output

Hi, I'd like to have a script what takes the 'who' output and grabs the user names and outputs just the user name, and no duplicates. I know I could do something like: who | awk '{print $1}' | uniq -u but I'd like to stay away from using the 'uniq' comand and just use awk. Thanks (5 Replies)
Discussion started by: lochraven
5 Replies

3. Shell Programming and Scripting

How to use uniq on a certain field?

How can I use uniq on a certain field or what else could I use? If I want to use uniq on the second field and the output would remove one of the lines with a 5. bob 5 hand jane 3 leg jon 4 head chris 5 lungs (1 Reply)
Discussion started by: Bandit390
1 Replies

4. UNIX for Dummies Questions & Answers

Difference between plain "uniq" and "uniq -u"

Dear all, It's not entirely clear to me from manpage the difference between them. Why we still need "-u" flag? - monkfan (3 Replies)
Discussion started by: monkfan
3 Replies

5. Shell Programming and Scripting

Help with uniq command

I call.... cat 1.txt | uniq -c Sample of whats in 1.txt vmstat cd exit w cd cd cd newgrp xinit f cd cd cd rlogin (2 Replies)
Discussion started by: Bandit390
2 Replies

6. Shell Programming and Scripting

Keep the last uniq record only

Hi folks, Below is the content of a file 'tmp.dat', and I want to keep the uniq record (key by first column). However, the uniq record should be the last record. 302293022|2|744124889|744124889 302293022|3|744124889|744124889 302293022|4|744124889|744124889 302293022|5|744124889|744124889... (4 Replies)
Discussion started by: ChicagoBlues
4 Replies

7. Shell Programming and Scripting

uniq -c

When I do uniq -c on a list of sorted numbers, for eg: 1 1 2 2 2 3 3 4 It outputs 2 1 3 2 2 3 1 4. Now, is there a way to sort on the column that "uniq -c" produced? (2 Replies)
Discussion started by: prasanna1157
2 Replies

8. Shell Programming and Scripting

uniq commmand

Hi I'm having a file (extract.txt) which contains lots of repeated values i want to extract it only with unique values,while am using the the uniq command It result's with 1510 lines this too have the duplicates,pls help me on this. I attached my extract.txt file as attachment here. ... (2 Replies)
Discussion started by: thelakbe
2 Replies

9. OS X (Apple)

Uniq tag

Hello, I have recently imported all my scripts into OS X. There is one unix command that is problematic in the new environment: sort temp7.txt | uniq -u -w4 > temp8.txt The system doesn't seem to like the -w tag. Is there an alternative command? Here is the objective: Data: 1234 aaa... (1 Reply)
Discussion started by: palex
1 Replies

10. Shell Programming and Scripting

Uniq help

hello I want to check on first column duplicates and print the unique first and second columns My trial output is not generating what I needed, i.e the second column. thanks in advance (5 Replies)
Discussion started by: bhargavpbk88
5 Replies
ypinit(1M)																ypinit(1M)

NAME
ypinit - build and install Network Information Service databases SYNOPSIS
NIS_domain] NIS_server_name NIS_domain] Remarks The Network Information Service (NIS) was formerly known as Yellow Pages (YP). Although the name has changed, the functionality of the service remains the same. DESCRIPTION
is a shell script that creates Network Information Service (NIS) databases on either a master or slave NIS server. asks a few self- explanatory questions, and reports success or failure to the terminal. For an overview of Network Information Service, see ypfiles(4) and ypserv(1M). Options recognizes the following options and command-line arguments: Create the local host as the master server to all maps (databases) provided in the NIS domain (see domainname(1)). All maps are built from scratch, either from information pro- vided to at run-time, or from ASCII files in All such files should be complete and unabbreviated, unlike how they may exist on a NIS client machine (see passwd(4) for examples of abbreviated files). See ypmake(1M) for more information on how NIS databases are built on the master server. Note that uses the option when invoking so newly formed maps are not immediately copied to slave servers (see ypmake(1M)). Create NIS databases on a slave server by copying the databases from an existing NIS server that serves the NIS domain. The NIS_server_name argument should be the host name of either the master server for all the maps or a server on which the maps are current and stable. Configures the local host as a NIS client, so that the NIS client will attempt to bind to a particular NIS server. Invocation of with a option prompts the user to construct a list of NIS servers, in the order of preference, to which the client will try to bind. Each of these NIS servers must be listed in the file along with its IP Address. This list of NIS servers is stored in the file This file is used by when invoked without the option. (See ypbind(1M) in ypserv(1M)). If it is so desired that it is not necessary for a NIS client to bind to a NIS server in a particular list, the installation mechanism could be ignored. Causes to construct maps for the specified NIS_domain. defaults to the NIS domain shown by the command (see domain- name(1). RETURN VALUE
returns exit code 0 if no errors occur; otherwise, it returns exit code 1. AUTHOR
was developed by Sun Microsystems, Inc. FILES
SEE ALSO
domainname(1), makedbm(1M), ypmake(1M), yppush(1M), ypserv(1M), ypxfr(1M), ypxfrd(1M), group(4), hosts(4), netgroup(4), networks(4), passwd(4), protocols(4), publickey(4), rpc(4), services(4), ypfiles(4). ypinit(1M)
All times are GMT -4. The time now is 01:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy