Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
2  
look into Regular Expressions (regex) zytrax.com/tech/web/regex.htm and the way awk uses them in linux: math.utah.edu/docs/info/gawk_5.html –  Frank Thomas Jun 17 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 at 18:14

1 Answer 1

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

http://linuxcommand.org/man_pages/grep1.html

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.