Sponsored Content
Full Discussion: check duplicate elements
Top Forums Shell Programming and Scripting check duplicate elements Post 302369483 by summer_cherry on Sunday 8th of November 2009 09:02:58 PM
Old 11-08-2009
Code:
my @intergers=( 1,2,3,3,4,5,4,99,99,100);
map {$hash{$_}++} @intergers;
print join " -- ", grep {$hash{$_} == 1} keys %hash;

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check host file for duplicate entries

I need a KSH script that will check a host file for duplicate IP's and/or host names and report out the errors. Anyone out there have one they would like to share? Something like: Hostname blahblah appears X times IP Address xxx.xxx.xxx.xxx appears X times TIA (4 Replies)
Discussion started by: ThreeDot
4 Replies

2. Shell Programming and Scripting

Find duplicate based on 'n' fields and mark the duplicate as 'D'

Hi, In a file, I have to mark duplicate records as 'D' and the latest record alone as 'C'. In the below file, I have to identify if duplicate records are there or not based on Man_ID, Man_DT, Ship_ID and I have to mark the record with latest Ship_DT as "C" and other as "D" (I have to create... (7 Replies)
Discussion started by: machomaddy
7 Replies

3. Shell Programming and Scripting

Request to check:remove entries with duplicate numbers in first row

Hi I have a file 1 xyz 456 1 xyz 456 1 xyz 456 2 abc 8459 3 gfd 657 4 ghf 658 4 ghf 658 I want the output 1 xyz 456 2 abc 8459 3 gfd 657 4 ghf 658 (3 Replies)
Discussion started by: manigrover
3 Replies

4. Shell Programming and Scripting

Check to identify duplicate values at first column in csv file

Hello experts, I have a requirement where I have to implement two checks on a csv file: 1. Check to see if the value in first column is duplicate, if any value is duplicate script should exit. 2. Check to verify if the value at second column is between "yes" or "no", if it is anything else... (4 Replies)
Discussion started by: avikaljain
4 Replies

5. Shell Programming and Scripting

Creating array with non-duplicate / unique elements in ksh

Hi all, I have created 3 arrays which can have common elements in each like- arr_a contains str1 str2 str3 str4 str5 arr_b contains str3 str6 str7 str1 str8 arr_c contains str4 str9 str10 str2 each array is created with "set -A arr_name values" command. I want to create a resultant array-say... (1 Reply)
Discussion started by: sanzee007
1 Replies

6. Programming

Array Elements Check

Hi everyone, :) I'm trying to make a simple C program that scans an array of chars to see if its elements are similar. I can't understand what's wrong. Could you help me to fix this? Here is the code. Thanks! #include<stdio.h> int main() { int arr; int i, len; int flag =... (10 Replies)
Discussion started by: IgorGest
10 Replies

7. Shell Programming and Scripting

Find duplicate values in specific column and delete all the duplicate values

Dear folks I have a map file of around 54K lines and some of the values in the second column have the same value and I want to find them and delete all of the same values. I looked over duplicate commands but my case is not to keep one of the duplicate values. I want to remove all of the same... (4 Replies)
Discussion started by: sajmar
4 Replies

8. Shell Programming and Scripting

Duplicate check by passing external parameter

I have a code which is using to find duplicates in a files based on column.Below is the same code which is used to find duplicates in my file based on column 1 awk -F'|' '{if (x) { x_count++; print $0; if (x_count == 1) { print x } } x = $0}' FileName >Dup_File.txt But my requirement here is... (3 Replies)
Discussion started by: ginrkf
3 Replies

9. Shell Programming and Scripting

Check/print missing number in a consecutive range and remove duplicate numbers

Hi, In an ideal scenario, I will have a listing of db transaction log that gets copied to a DR site and if I have them all, they will be numbered consecutively like below. 1_79811_01234567.arc 1_79812_01234567.arc 1_79813_01234567.arc 1_79814_01234567.arc 1_79815_01234567.arc... (3 Replies)
Discussion started by: newbie_01
3 Replies

10. Shell Programming and Scripting

How to check duplicate entries in file ? (Solaris-9)

Hi, There are duplicate entries in file, but uniq will not see because first field is different. How will I catch all lines, which are having duplicate IPs ? bash-2.05# cat db.file | grep 172.30.133.11 dsrq-ctrl1-prod A 172.30.133.11 e911q-db1-nxge0 A 172.30.133.11... (4 Replies)
Discussion started by: solaris_1977
4 Replies
GRID-MAPFILE-CHECK(8)						  Globus Commands					     GRID-MAPFILE-CHECK(8)

NAME
grid-mapfile-check-consistency - Add an entry to a grid map file SYNOPSIS
grid-mapfile-check-consistency [-h] [-help] [-usage] [-version] grid-mapfile-check-consistency [-mapfile MAPFILE] | [-f MAPFILE] DESCRIPTION
The grid-mapfile-check-consistency program performs basic checks for validity of a gridmap file. These checks include checks for existence, duplication of entries, and valid local user names. If the gridmap file is valid, grid-mapfile-check-consistency exits with a zero exit code, otherwise it exits with a non-zero exit code. In either case, it displays information about its progress as it parses and validates the gridmap file. By default, grid-mapfile-check-consistency will check the gridmap file named by the GRIDMAP environment variable if present. If that variable is not set, it will check the file $HOME/.gridmap for non-root users if present. If that doesn't exist or grid-mapfile-check-consistency is run as root, it will then check /etc/grid-security/grid-mapfile. This can be changed by the use of the -mapfile or -f command-line options. The full set of command-line options to grid-mapfile-check-consistency are: -help, -h, -usage Display the command-line options to grid-mapfile-check-consistency. -version Display the version number of the grid-mapfile-check-consistency command. -mapfile MAPFILE, -f MAPFILE Check the gridmap file named by MAPFILE instead of the default. EXAMPLES
Check that the gridmap file in /etc/grid-security is valid: % grid-mapfile-check-consistency -f /etc/grid-security/grid-mapfile Checking /etc/grid-security/grid-mapfile Verifying grid mapfile existence...OK Checking for duplicate entries...OK Checking for valid user names...OK Check a gridmap file that has an invalid local user name: % grid-mapfile-check-consistency -f /etc/grid-security/grid-mapfile Checking /etc/grid-security/grid-mapfile Verifying grid mapfile existence...OK Checking for duplicate entries...OK ERROR: baduser is not a valid local username ERROR: Found 1 invalid username(s) ENVIRONMENT VARIABLES
The following environment variables affect the execution of grid-mapfile-check-consistency: GRIDMAP Path to the default gridmap to check. FILES
The following files affect the execution of grid-mapfile-check-consistency: $HOME/.gridmap Path to the default gridmap to check if the GRIDMAP environment variable is not set for non-root users. /etc/grid-security/grid-mapfile Path to the default gridmap to check if GRIDMAP environment variable is not set and the above file does not exist. SEE ALSO
grid-mapfile-add-entry(8), grid-mapfile-delete-entry(8) AUTHOR
University of Chicago Globus Toolkit 5.0.1 03/19/2010 GRID-MAPFILE-CHECK(8)
All times are GMT -4. The time now is 04:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy