Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to linux. I want to be placed as a System Admin. I attended an interview at Amazon. They asked me to write a cmd to find the string that starts with 's' and ends with 'a' in a file. I know that we have to use grep, but I don't know how to use it. Added to this they also asked how grep works. Can anyone brief out an answer for this?

Thanks in advance

share|improve this question
look into Regular Expressions (regex) and the way awk uses them in linux: – Frank Thomas Jun 17 '14 at 12:44
What have you tried? You should first try Google, read up on grep, and if you still have a problem, ask here (and include what you have tried). – BenjiWiebe Jun 17 '14 at 18:14
up vote 0 down vote accepted

Man pages are the most helpful. They take some time to read through, however as a budding sysadmin (congrats!) it will behoove you to start being able to navigate and understand man pages

Many man pages are on the internet, so you can google search "grep man page" and find one

Here is one I found

In the man page a little over halfway down you will see a discussion of "REGULAR EXPRESSIONS". The above command does not require anything tricky in the way of regular expressions, you just want a regular expression to match a character at the beginning of the string and at the end of the string

Good luck!

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .