I am new to Shell scripting. I am trying to write a code that should grep few lines from a huge file based on certain condition.
Contents of file, say names.txt
1 ae1aee2sonata om,vadodara,23-Aug-2016
2 chdc501ae om,patna,26-Aug-2016
3 chdc4326aee6 om,bhuvi,01-Oct-2016
4 ae3aee6prsons hqr,bangalore,29-Aug-2016
5 praaeei5 om,lucknow,11-Nov-2016
6 aetaeen6pana om,phanto,13-Oct-2016
and goes on for 500 or more entries.
Now, I am looking for output for the following :
- Filter lines with only "aee" available in it. So, the output will look like:
3 chdc4326aee6.om,bhuvi,01-Oct-2016 5 praaeei5 om,lucknow,11-Nov-2016
- Filter lines with only "ae" and "ae + "aee" available in the file. So, the output will look like:
1 ae1aee2sonata.hqr,vadodara,23-Aug-2016 2 chdc501ae.om,patna,26-Aug-2016 4 ae3aee6prsons hqr,bangalore,29-Aug-2016 6 aetaeen6pana om,phanto,13-Oct-2016
- Filter lines with only "ae" from the file. So, the output will look like:
2 chdc501ae.om,patna,26-Aug-2016
Any suggestions please. You can point to a good place for getting more information about this, so I can learn.