keep duplicate number records only - perl
Posted
by manu
on Stack Overflow
See other posts from Stack Overflow
or by manu
Published on 2010-05-07T09:49:58Z
Indexed on
2010/05/07
9:58 UTC
Read the original article
Hit count: 327
perl
Hello
I have one text string which is having some duplicate characters (FFGGHHJKL), these can be made unique by using the positive lookahead [perl script for the same$ perl -pe 's/(.)(?=.*?\1)//g']. (FFEEDDCCGG OUTPUT ==> FEDCG)
My question is how to make it work on the numbers (Ex. 212 212 43 43 5689 6689 5689 71 81 === output should be 212 43 5689 6689 71 81) ? Also if we want to have only duplicate records to be given as the output from a file having n rows
(212 212 43 43 5689 6689 5689 71 81 \n 66 66 67 68 69 69 69 71 71 52 ..\n .. .. \n...
OUTPUT ==> 212 212 43 43 5689 5689 \n 66 66 69 69 69 71 71)
then what should be done ?
Thanks and regards -manu
© Stack Overflow or respective owner