Help in duplicated chars in password


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help in duplicated chars in password
# 1  
Old 11-19-2011
Help in duplicated chars in password

i have code to generate passwords but the issue is the duplicated chars
so can any one help and give me function to check and verify if there is any duplicated chars as also the script uses capitals and small letters and numbers only
many thx guys
# 2  
Old 11-19-2011
Do you mean anywhere in the string, or consecutively?

Code:
sed -n 's/\(.\).*\1/&/p'

Remove the bit in red, if the latter.
# 3  
Old 11-19-2011
i need to check if the word have duplicated characters or not i don want to remove the duplicated

like

Manm --> failed
Man --> pass
# 4  
Old 11-19-2011
Hi.

You asked for something that can identify duplicate characters.

You didn't answer my question, as to whether those characters could be consecutive, or not.

The code given will remove nothing, and will print the same string back if it contains duplicate characters, otherwise it will print nothing. Keyword here being "print" (emphasis on a lack of the word "remove"!)

You could use that as a basis for what you do next.
# 5  
Old 11-19-2011
thanks man for your replay

what im try to do is genrtae uniq passwords by script
ex: 99cfdc6b this is an output for script but i don't accept this as password coz i need to check

if the password contains duplicated chars or not so if it contains it will be rejected and will generate new one if it didn't have any duplicated chars it will accept as passwords
i hope i clarify the situation here

---------- Post updated at 02:43 PM ---------- Previous update was at 02:34 PM ----------

one of my frinds complete this issue in .net C# the code is like this
Code:
static void Main(string[] args)
{

string str = Console.ReadLine();

str = str.ToLower();
int len1 = str.Length - 1;

for (int i = 0; i < str.Length; i++)
{

for (int x = 0; x <= len1; x++)
{

if (x == i)
{
continue;
}
if (str[i] == str[x])
{
goto A;
}
}
}
Console.WriteLine("Nothing Repeated");
return;
A:
Console.WriteLine("Some Characters are reapeated");
return;

}


but im unable to translate this into linux coz im not 100% good with shell scripts

Moderator's Comments:
Mod Comment Please use code tags when posting data and code samples, thank you.

Last edited by Franklin52; 11-21-2011 at 08:02 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Forum Support Area for Unregistered Users & Account Problems

Password sent via reset password email is 'weak' and won't allow me to change my password

I was unable to login and so used the "Forgotten Password' process. I was sent a NEWLY-PROVIDED password and a link through which my password could be changed. The NEWLY-PROVIDED password allowed me to login. Following the provided link I attempted to update my password to one of my own... (1 Reply)
Discussion started by: Rich Marton
1 Replies

2. UNIX for Beginners Questions & Answers

Shell script to split data with a delimiter having chars and special chars

Hi Team, I have a file a1.txt with data as follows. dfjakjf...asdfkasj</EnableQuotedIDs><SQL><SelectStatement modified='1' type='string'><! The delimiter string: <SelectStatement modified='1' type='string'><! dlm="<SelectStatement modified='1' type='string'><! The above command is... (7 Replies)
Discussion started by: kmanivan82
7 Replies

3. Shell Programming and Scripting

How to remove duplicated lines?

Hi, if i have a file like this: Query=1 a a b c c c d Query=2 b b b c c e . . . (7 Replies)
Discussion started by: the_simpsons
7 Replies

4. UNIX for Dummies Questions & Answers

Removing duplicated lines??

Hi Guys.. I have a problem for some reason my database has copied everything 4 times. My Database looks like this: >BAC233456 rhjieaheiohjteo tjtjrj6jkk6k6 j54ju54jh54jh >ANI124365 afrhtjykulilil htrjykuk rtkjryky ukrykyrk >BAC233456 rhjieaheiohjteo tjtjrj6jkk6k6 j54ju54jh54jh... (6 Replies)
Discussion started by: Iifa
6 Replies

5. UNIX for Dummies Questions & Answers

Duplicated UID

Hi folks! I need you help to discover what's the impact of a duplicated UID in an operating system. What's the meaning when someone put in different users the same UID? (3 Replies)
Discussion started by: phcostabh
3 Replies

6. Shell Programming and Scripting

Help with remove duplicated content

Input file: hcmv-US25-2-3p hsa-3160-5 hcmv-US33 hsa-47 hcmv-UL70-3p hsa-4508 hcmv-UL70-3p hsa-4486 hcms-US25 hsa-360-5 hcms-US25 hsa-4 hcms-US25 hsa-458 hcms-US25 hsa-44812 . . Desired Output file: hcmv-US25-2-3p hsa-3160-5 hcmv-US33 hsa-47 hcmv-UL70-3p hsa-4508 hsa-4486... (3 Replies)
Discussion started by: perl_beginner
3 Replies

7. Shell Programming and Scripting

find 4 chars on 2nd line, 44 chars over

I know this should be simple, but I've been manning sed awk grep and find and am stupidly stumped :( I'm trying to use sed (or awk, find, etc) to find 4 characters on the second line of a file.txt 44-47 characters in. I can find lots of sed things for lines, but not characters. (4 Replies)
Discussion started by: unclecameron
4 Replies

8. Shell Programming and Scripting

remove duplicated columns

hi all, i have a file contain multicolumns, this file is sorted by col2 and col3. i want to remove the duplicated columns if the col2 and col3 are the same in another line. example fileA AA BB CC DD CC XX CC DD BB CC ZZ FF DD FF HH HH the output is AA BB CC DD BB CC ZZ FF... (6 Replies)
Discussion started by: kamel.seg
6 Replies

9. Shell Programming and Scripting

How to convert C source from 8bit chars to 16bit chars?

I was using the following bash command inside the emacs compile command to search C++ source code: grep -inr --include='*.h' --include='*.cpp' '"' * | sed "/include/d" | sed "/_T/d" | sed '/^ *\/\//d' | sed '/extern/d' Emacs will then position me in the correct file and at the correct line... (0 Replies)
Discussion started by: siegfried
0 Replies

10. UNIX for Advanced & Expert Users

Can root ID be duplicated

Hi, I have the root id and the uid is always 0 for the root. Can i create another user say admin with the uid as 0? If so will it have the same privilege as that of user. Will there be any effect while doing this? lorcan (6 Replies)
Discussion started by: lorcan
6 Replies
Login or Register to Ask a Question