Interview Fail Question
Morning All,
I had this question yesterday and after being up 13 hours straight and then going to an interview i completely had a brain lapse and still am having one trying to figure the answer to this. below is the contents of a file : BANCA ITALIA IT2920c08378 BANK OF MILAN IT28376152a7 You need to change the IT in the end string to FR without effecting any other IT's within the file. I straight away thought of a sed statement however since i cant seem to do it. |
sed will certainly do it - best to use the "$" anchor; say IT([[:xdigit:]]+$)
|
Quote:
|
How would it look it I gave you the whole answer ..... :tisk:
You gotta put in some effort for those interviews .... :p |
Quote:
I seriously doubt that this eentsy, little question was the whole downfall of an interview that was one question away from being a done deal. Quote:
If you had to pull an all night study session for some interview, then you aren't qualified for the job. If the reason instead was because you stayed up late due to some other reason, then whatever kept you up late was obviously more important to you. Either case, a lack of sleep is not the end of the world, your abilities did not suddenly disappear because you had a difficult preceding day and night before this interview. One little question does not break an interview. I submit that most interviewers, especially if they feel a person is competent and happened to ask that question of you, and your response was "I'm thinking that I'd use sed for this, but the exact syntax escapes me right now, I'd have to work that through on a terminal or re-look up my regular expressions to get it right, but I do realize the problem here is that the search term appears in areas beyond the intended change points ...", in that case I feel a forgiving interviewer who already feels you're pretty close to being qualified, would let that one slide. I'm thinking here that you were always a stretch for this particular job and not being able to answer this question was just one more brick in the wall. |
Hmm... I think I'm gonna try to solve this myself. I like fiddling with sed.
syg00 has pretty much given us the solution, now we just need to implement it properly. Edit: Ok, after a bit of trial and error this seems to work Code:
sed 's/IT\([0-9]\)/FR\1/g' |
HMW, it was nice of you to provide a way. Can you also explain it?
I'm not for or against full answers. To each their own. I'd teach younger people by having them do some work however. It doesn't seem mean to me to have a user work a bit. |
Quote:
Code:
sed 's/IT\([0-9]\)/FR\1/g' Search for the capital letters IT followed by any digit in the range 0-9. The round brackets also saves the digit. /FR\1/g: Replace the letter IT with the letters FR, and put the saved digit back after FR with \1. Do it globally by using 'g'. I hope that made sense! |
Quote:
Why would you want to change the country code of two Italian banks to France? They obviously couldn't be bothered to formulate a realistic situation. :doh: |
Quote:
Death therefore is to have a primary talent highlighted on your resume and know absolutely zip about it. Which of course NEVER happens! :rolleyes: |
Quote:
If the candidate gets more than 50 at 3 or above they stand a good chance of getting brought in for a more conventional face-to-face where we talk about experience, projects and do a drill-down. I've had several people apply for operations admin jobs that have scored extremely low on the first 23 questions, including one guy that answered 20 out of the 23 with "I don't know". Each company and each interviewer has their own methods. |
The question goes to the ability to write regular expressions.
An additional finesse would be to use the sed capability to match an exact number of sequences. Code:
sed 's:IT\(.\{10\}$\):FR\1:' |
This is all you need:
Code:
sed 's/IT28/FR28/g' |
Quote:
OK sorry, no offense intended. I really am joking and actually DO understand how that is applicable for your situation and the jobs you interview people for. My situation has always been R&D. New college hires know nothing, but what they've studied. They need to at least talk about their theory courses enough to convince me that they really are a B.S.E.E. student. For everyone else, you've worked on "something", and if you can't even talk about that, then "get outta my face". Yeah, plenty of stories ... |
Quote:
Also knowing when one doesn't know is a good thing. "I don't know, but I can find out" has been my answer to some Interview Questions in the past. |
All times are GMT -5. The time now is 07:16 PM. |