LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-18-2015, 04:24 AM   #1
MrLinuxDonnelly
LQ Newbie
 
Registered: May 2015
Location: London, United Kingdom
Distribution: Redhat 6.5, Centos, Fedora
Posts: 28

Rep: Reputation: Disabled
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.
 
Old 06-18-2015, 05:04 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,999

Rep: Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219
sed will certainly do it - best to use the "$" anchor; say IT([[:xdigit:]]+$)
 
1 members found this post helpful.
Old 06-18-2015, 05:19 AM   #3
MrLinuxDonnelly
LQ Newbie
 
Registered: May 2015
Location: London, United Kingdom
Distribution: Redhat 6.5, Centos, Fedora
Posts: 28

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by syg00 View Post
sed will certainly do it - best to use the "$" anchor; say IT([[:xdigit:]]+$)
What would the actual command be ?
 
Old 06-18-2015, 05:57 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,999

Rep: Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219
How would it look it I gave you the whole answer .....
You gotta put in some effort for those interviews ....
 
1 members found this post helpful.
Old 06-18-2015, 07:34 AM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 5,983
Blog Entries: 12

Rep: Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044
Quote:
Originally Posted by syg00 View Post
How would it look it I gave you the whole answer .....
Shaking head, rolling eyes in agreed commiseration.

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:
Originally Posted by syg00 View Post
You gotta put in some effort for those interviews ....
@OP perhaps you ought to consider a couple of possible points here, such as why you were up 13 hours straight before this interview. Which is not so amazing when you think about it. Gee, I sleep about 7-8 hours per night, therefore I'm "up" for 16 or more hours per day. Pretty much we ALL are.

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.
 
Old 06-18-2015, 08:32 AM   #6
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 770
Blog Entries: 3

Rep: Reputation: 368Reputation: 368Reputation: 368Reputation: 368
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'
Might not be as foolproof as what syg00 suggested, but still.

Last edited by HMW; 06-18-2015 at 02:33 PM.
 
Old 06-18-2015, 08:28 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 17,195

Rep: Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562
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.
 
Old 06-19-2015, 05:53 AM   #8
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 770
Blog Entries: 3

Rep: Reputation: 368Reputation: 368Reputation: 368Reputation: 368
Quote:
Originally Posted by jefro View Post
HMW, it was nice of you to provide a way. Can you also explain it?
I'll do my best, since I am now sitting in front of a machine running Windows 7.
Code:
sed 's/IT\([0-9]\)/FR\1/g'
s/IT\([0-9]\):
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!

Last edited by HMW; 06-19-2015 at 05:54 AM.
 
1 members found this post helpful.
Old 06-19-2015, 07:46 AM   #9
JeremyBoden
Senior Member
 
Registered: Nov 2011
Distribution: Debian
Posts: 1,193

Rep: Reputation: 243Reputation: 243Reputation: 243
Quote:
Originally Posted by MrLinuxDonnelly View Post
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.
This is a typically stupid interview question.
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.
 
Old 06-19-2015, 08:12 AM   #10
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 5,983
Blog Entries: 12

Rep: Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044
Quote:
Originally Posted by JeremyBoden View Post
This is a typically stupid interview question.
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.
I never ask "canned" questions. Instead I ask the person to describe what they've worked on. Be they student or someone who has worked, they've typically done a project of some type, which they should be able to describe well enough to me to convince me that they understand what they've done.

Death therefore is to have a primary talent highlighted on your resume and know absolutely zip about it. Which of course NEVER happens!
 
Old 06-19-2015, 10:50 AM   #11
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,575

Rep: Reputation: 938Reputation: 938Reputation: 938Reputation: 938Reputation: 938Reputation: 938Reputation: 938Reputation: 938
Quote:
Originally Posted by rtmistler View Post
I never ask "canned" questions.
I've a list of 50 "canned" questions, 23 of which get asked in a telephone interview that should take no more than 20 minutes. Candidates get graded 0 to 5 depending on their answer, the time taken, the way the answer is communicated etc. I use this method to pre-screen candidates before a face-to-face, where the other questions may or may not get asked.

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.
 
Old 06-19-2015, 11:10 AM   #12
allend
Senior Member
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 4,690

Rep: Reputation: 1574Reputation: 1574Reputation: 1574Reputation: 1574Reputation: 1574Reputation: 1574Reputation: 1574Reputation: 1574Reputation: 1574Reputation: 1574Reputation: 1574
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:'
 
Old 06-19-2015, 11:23 AM   #13
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: Slackware
Posts: 7,710

Rep: Reputation: 2991Reputation: 2991Reputation: 2991Reputation: 2991Reputation: 2991Reputation: 2991Reputation: 2991Reputation: 2991Reputation: 2991Reputation: 2991Reputation: 2991
This is all you need:

Code:
sed 's/IT28/FR28/g'

Last edited by dugan; 06-19-2015 at 11:27 AM.
 
Old 06-19-2015, 11:33 AM   #14
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 5,983
Blog Entries: 12

Rep: Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044Reputation: 2044
Quote:
Originally Posted by TenTenths View Post
I've a list of 50 "canned" questions, 23 of which get asked in a telephone interview that should take no more than 20 minutes. Candidates get graded 0 to 5 depending on their answer, the time taken, the way the answer is communicated etc. I use this method to pre-screen candidates before a face-to-face, where the other questions may or may not get asked.

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.
You're evil! (Making devil sign with my hand and hissing)

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 ...
 
Old 06-19-2015, 12:07 PM   #15
Habitual
LQ 5k Club
 
Registered: Jan 2011
Location: Nowhere near you, thank God.
Distribution: High Sierra
Posts: 8,598
Blog Entries: 15

Rep: Reputation: Disabled
Quote:
Originally Posted by TenTenths View Post
one guy that answered 20 out of the 23 with "I don't know".
Which is a perfectly acceptable answer in my book, (but 20/23? that's Scary). One has to know what he doesn't know and be able to admit it.
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
interview question .. rockstar05 Linux - Newbie 2 02-15-2012 03:12 PM
interview question vishalyadav22 Linux - Newbie 3 03-12-2011 07:18 AM
Interview Question infovijay Linux - Server 2 11-04-2009 07:18 AM
Interview Question help coffeefeifei Linux - Software 4 08-12-2009 10:01 PM
interview question sulekha Linux - General 5 11-13-2008 10:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration