LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 03:24 AM   #1
MrLinuxDonnelly
Member
 
Registered: May 2015
Location: London, United Kingdom
Distribution: Redhat 6.5, Centos, Fedora
Posts: 33

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, 04:04 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

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

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, 04:57 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
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, 06:34 AM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
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, 07:32 AM   #6
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
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 01:33 PM.
 
Old 06-18-2015, 07:28 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,978

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
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, 04:53 AM   #8
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
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 04:54 AM.
 
1 members found this post helpful.
Old 06-19-2015, 06:46 AM   #9
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
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, 07:12 AM   #10
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
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, 09:50 AM   #11
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
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, 10:10 AM   #12
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
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, 10:23 AM   #13
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,222

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

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

Last edited by dugan; 06-19-2015 at 10:27 AM.
 
Old 06-19-2015, 10:33 AM   #14
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
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, 11:07 AM   #15
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

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



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 02:12 PM
interview question vishalyadav22 Linux - Newbie 3 03-12-2011 06:18 AM
Interview Question infovijay Linux - Server 2 11-04-2009 06:18 AM
Interview Question help coffeefeifei Linux - Software 4 08-12-2009 09:01 PM
interview question sulekha Linux - General 5 11-13-2008 09:33 AM

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

All times are GMT -5. The time now is 08:16 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
Open Source Consulting | Domain Registration