BoxunloX
asked on
Help with SED Command
Hello all,
Ok I don't know if this is against forum rules or not. I am not asking for an answer here, I am simply looking for help getting started. I have this homework question that is as follows:
Using the emp.lst data file generate a list of all the employees formatted as firstname, lastname 19xx where xx it the year of birth from the birth date field. Sort the list in alphabetical order. For maximum credit solve the problem without using the cut command.
What he wants us to use is the SED command. The file is as follows:
2233:charles harris :g.m. :sales :12/12/52: 90000
9876:bill johnson :director :production :03/12/50:130000
5678:robert dylan :d.g.m. :marketing :04/19/43: 85000
2365:john woodcock :director :personnel :05/11/47:120000
5423:barry wood :chairman :admin :08/30/56:160000
1006:gordon lightfoot :director :sales :09/03/38:140000
6213:michael lennon :g.m. :accounts :06/05/62:105000
1265:p.j. woodhouse :manager :sales :09/12/63: 90000
4290:neil o'bryan :executive :production :09/07/50: 65000
2476:jackie wodehouse :manager :sales :05/01/59:110000
6521:derryk o'brien :director :marketing :09/26/45:125000
3212:bill wilcocks :d.g.m. :accounts :12/12/55: 85000
3564:ronie trueman :executive :personnel :07/06/47: 75000
2345:james wilcox :g.m. :marketing :03/12/45:110000
0110:julie truman :g.m. :marketing :12/31/40: 95000
Please help.
Ok I don't know if this is against forum rules or not. I am not asking for an answer here, I am simply looking for help getting started. I have this homework question that is as follows:
Using the emp.lst data file generate a list of all the employees formatted as firstname, lastname 19xx where xx it the year of birth from the birth date field. Sort the list in alphabetical order. For maximum credit solve the problem without using the cut command.
What he wants us to use is the SED command. The file is as follows:
2233:charles harris :g.m. :sales :12/12/52: 90000
9876:bill johnson :director :production :03/12/50:130000
5678:robert dylan :d.g.m. :marketing :04/19/43: 85000
2365:john woodcock :director :personnel :05/11/47:120000
5423:barry wood :chairman :admin :08/30/56:160000
1006:gordon lightfoot :director :sales :09/03/38:140000
6213:michael lennon :g.m. :accounts :06/05/62:105000
1265:p.j. woodhouse :manager :sales :09/12/63: 90000
4290:neil o'bryan :executive :production :09/07/50: 65000
2476:jackie wodehouse :manager :sales :05/01/59:110000
6521:derryk o'brien :director :marketing :09/26/45:125000
3212:bill wilcocks :d.g.m. :accounts :12/12/55: 85000
3564:ronie trueman :executive :personnel :07/06/47: 75000
2345:james wilcox :g.m. :marketing :03/12/45:110000
0110:julie truman :g.m. :marketing :12/31/40: 95000
Please help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi Box,
A lot of these things are wrappers around the same core tools.
While they are completely separate programs, sed is quite simple. awk is sed on steriods. Perl is a complete programming language that is awk on mega-steroids.
It all becomes a lot easier if you can learn their common key, that is "regular expressions". Once you understand them, the tool that's putting them into play becomes easy.
You'll like unix once you get comfortable with it.
Good Luck,
Kent
A lot of these things are wrappers around the same core tools.
While they are completely separate programs, sed is quite simple. awk is sed on steriods. Perl is a complete programming language that is awk on mega-steroids.
It all becomes a lot easier if you can learn their common key, that is "regular expressions". Once you understand them, the tool that's putting them into play becomes easy.
You'll like unix once you get comfortable with it.
Good Luck,
Kent
ASKER
Thank you guys. As I stated in my reply to kdo, this class has basically forced UNIX down our throats in a very short period of time. I have been doing sysadmin (on the Windows side) for a few years now and these homework questions just make me feel dumb. Anyway, thanks again and if I make it through this class alive I may think of broadening my UNIX skills on my own time in the future;)
ASKER
Thanks again.