Check 2 variables for matching characters

 
Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions Check 2 variables for matching characters
# 1  
Old 09-20-2011
Check 2 variables for matching characters

hi
i am writing a hangman script and am having trouble checking the correct letters against the word
i need the script to compare the word against the letters guessed that are correct so once all the letters within the word have been guessed it will alow me to create a wining senario
this must be done without using sed or awk

eg

word
hello

guessed
adhewlso

this would be a correct result because all the letters within the word have been guessed

any help would be appreciated im stumped by this
# 2  
Old 09-20-2011
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep with ... matching more than 3 characters

I am trying to understand what the grep command in ubuntu is trying to do here. The contents of my test file is given below harsha@harsha-H67MA-USB3-B3:~/Documents$ cat data abcd efghi jklmno pqr stuv wxyz When I grep for 3 dots (...) without the parenthesis as follows I would expect the... (4 Replies)
Discussion started by: sreeharshasn
4 Replies

2. Shell Programming and Scripting

Perl Matching multiple variables

I am trying to match mulitple (3) variables. I found the sub given below on the web which works well when all vars are defined. But there are situations where one or two will not be defined (at least one will always be defined.) Example of the variable content possibilities The sub found... (4 Replies)
Discussion started by: popeye
4 Replies

3. Programming

Matching first n characters in a line in a file

hi to all, i am writing a simple file program in C which has to take a string of length n as input and match that input string with first n character of the line in file. if it does not match it has to compare with first n characters of next line. i am finding it difficult to know how exactly to... (2 Replies)
Discussion started by: ntrikoti
2 Replies

4. Homework & Coursework Questions

Matching and Replacing Characters

I need to write an Unix script to report the number of SQL files in my home directory, ending with .sql . The script should, also, be checking whether there is a file with an underscore in its name. If that is the case, the underscore should be converted to a dash (‐); for example... (1 Reply)
Discussion started by: ronoz-4
1 Replies

5. UNIX for Dummies Questions & Answers

Matching the [] characters

I want to check where our programmers are using "delete" instead of "delete" in their C++ code: grep -r delete *cpp | grep -v However, this statement and variations thereof (escaping with backslash (\), single quotes ('), double quotes ("), accolades ({)) always lead to the following message:... (2 Replies)
Discussion started by: figaro
2 Replies

6. Shell Programming and Scripting

Help with checking that 2 variables contain matching characters

hi i am writing a hangman script and am having trouble checking the correct letters against the word i need the script to compare the word against the letters guessed that are correct so once all the letters within the word have been guessed it will alow me to create a wining senario eg ... (3 Replies)
Discussion started by: lsecer
3 Replies

7. UNIX for Dummies Questions & Answers

Matching numbers of characters in two lines

Dear all, I'm stuck on a certain problem regarding counting the number of characters in one line and then adjusting the number of characters of another line to this number. This was my original input data: @HWI-ST471_57:1:1:1231:2079/2... (4 Replies)
Discussion started by: DerSeb
4 Replies

8. Shell Programming and Scripting

Matching a pattern between two characters (sed)

Hi there, I have a file with lines like these: 0105:ffff0000:001b:01f4:25:434 0299:ffff0000:0009:01f4:2:319 02d2:ffff0000:000e:01f4:2:507 The above values are split up using ":" characters. I would like capture each value, no matter what length. Take for example the first line... (8 Replies)
Discussion started by: MastaG
8 Replies

9. UNIX for Dummies Questions & Answers

pattern matching w/ unexpected characters

how do i check if the first character is a parenthese in pattern matching? if ] obviously doesnt work. How do I use it to compare so it doesnt try to use it to group. (5 Replies)
Discussion started by: questionasker
5 Replies

10. UNIX for Dummies Questions & Answers

matching characters between strings

please send the logic or program to find the matching characters between two strings for ex string1 :abc string2 :adc no .of matching characters is 2(a,c) (9 Replies)
Discussion started by: akmtcs
9 Replies
Login or Register to Ask a Question