Sponsored Content
Top Forums UNIX for Advanced & Expert Users Find duplicate words using sed Post 302891688 by jnrohit2k on Friday 7th of March 2014 09:57:33 AM
Old 03-07-2014
Find duplicate words using sed

I have following statement and I want to find duplicate word using sed command. How is it possible?

"detect string and remove the duplicate string"

There could be many statements in a file and each line may have duplicate word.

Thanks!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Duplicate words

Hi, can anyone help me with this small problem. Say i've got duplicate words in a list e.g blue orange green green pink blue red How can I delete all reoccurences of the same word? Thanks (1 Reply)
Discussion started by: zulander
1 Replies

2. Shell Programming and Scripting

remove duplicate words in a line

Hi, Please help! I have a file having duplicate words in some line and I want to remove the duplicate words. The order of the words in the output file doesn't matter. INPUT_FILE pink_kite red_pen ball pink_kite ball yellow_flower white no white no cloud nine_pen pink cloud pink nine_pen... (6 Replies)
Discussion started by: sam_2921
6 Replies

3. Shell Programming and Scripting

Shell script to find out words, replace them and count words

hello, i 'd like your help about a bash script which: 1. finds inside the html file (it is attached with my post) the code number of the Latest Stable Kernel, 2.finds the link which leads to the download location of the Latest Stable Kernel version, (the right link should lead to the file... (3 Replies)
Discussion started by: alex83
3 Replies

4. 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

5. Shell Programming and Scripting

[Solved] Find duplicate and add pattern in sed/awk

<Update> I have the solution: sed 's/\{3\}/&;&;---;4/' The thread can be marked as solved! </Update> Hi There, I'm working on a script processing some data from a website into cvs format. There is only one final problem left I can't find a solution. I've processed my file... (0 Replies)
Discussion started by: lolworlds
0 Replies

6. Shell Programming and Scripting

Remove very first pair of duplicate words

I have file which is almost look like below MMIT MMIT ... (2 Replies)
Discussion started by: manas_ranjan
2 Replies

7. Shell Programming and Scripting

Find duplicate words in first column between "10" repetiotions

hello I have a file of the form: nameA number number ... nameB number number ... nameA number number ... nameC number number ... nameD number number ... 10 nameA number number ... nameC number number ... nameB number number ... nameC number number ...... (4 Replies)
Discussion started by: phaethon
4 Replies

8. UNIX for Dummies Questions & Answers

Remove duplicate words from column 1

Tried using sed and uniq but it's removing the entire line. Can't seem to figure a way to just remove the word. Any help is appreciated. I have a file: dog, text1, text2, text3 dog, text1, text2, text3 dog, text1, text2, text3 cat, text1, text2, text3 Trying to remove all duplicate instances... (6 Replies)
Discussion started by: jimmyf
6 Replies

9. Shell Programming and Scripting

sed Find and Replace Text Between Two Strings or Words

I am looking for a sed in which I can recognize all of the text in between two indicators and then replace it with a place holder. For instance, the 1st indicator is a list of words "no|noone|havent" and the 2nd indicator is a list of punctuation ".|,|!".From a sentence such as "noone... (3 Replies)
Discussion started by: owwow14
3 Replies

10. Shell Programming and Scripting

Awk, sed, shell all words in INPUT.txt find in column1 of TABLE.txt and replce with column2 in

Hi dears i have text file like this: INPUT.txt 001_1_173 j nuh ]az 001_1_174 j ]esma. nuh ]/.xori . . . and have another text like this TABLE.txt j j nuh word1... (6 Replies)
Discussion started by: alii
6 Replies
PGADuplicate(8) 						      PGAPack							   PGADuplicate(8)

NAME
PGADuplicate - determines if a specified string is a duplicate of one already in an existing population INPUT PARAMETERS
ctx - context variable p - string index pop1 - symbolic constant of the population containing string p pop2 - symbolic constant of the (possibly partial) population containing strings to compare string p against n - the number of strings in pop2 to compare string p against n -1) OUTPUT PARAMETERS
none SYNOPSIS
#include "pgapack.h" int PGADuplicate(ctx, p, pop1, pop2, n) PGAContext *ctx int p int pop1 int pop2 int n LOCATION
duplcate.c EXAMPLE
0,...,n-1 in population pop2. Otherwise returns PGA_FALSE Example: Change any string in PGA_NEWPOP that is an exact copy of a string in PGA_OLDPOP. PGAContext *ctx; int b, n; : n = PGAGetPopsize(ctx); for (b=0; b<n; b++) if (PGADuplicate(ctx, b, PGA_NEWPOP, PGA_OLDPOP, n)) PGAChange(ctx, b, PGA_NEWPOP); Check if the best string in population PGA_OLDPOP is a duplicate of any of the strings in the first half of population PGA_NEWPOP. PGAContext *ctx; int b, n; : b = PGAGetBestIndex(ctx, PGA_OLDPOP); n = PGAGetPopsize(ctx) / 2; if (PGADuplicate(ctx, b, PGA_OLDPOP, PGA_NEWPOP, n)) printf("A duplicate!0); 05/01/95 PGADuplicate(8)
All times are GMT -4. The time now is 01:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy