Student just starting to learn shell script
I have file named
smallFile
John:Doe:ECE:3.54:doe@jd.home.org:111.222.3333
James:Davis:ECE:3.71:davis@jd.work.org:111.222.1111
Al:Davis:CS:2.63:davis@a.lakers.org:111.222.2222
Ahmad:Rashid:MBA:3.74:ahmad@mba.org:111.222.4444
Sam:Chu:ECE:3.68:chu@sam.ab.com:111.222.5555
Arun:Roy:SS:3.06:roy@ss.arts.edu:111.222.8888
Rick:Marsh:CS:2.34:marsh@a.b.org:111.222.6666
James:Adam:CS:2.77:jadam@a.b.org:111.222.7777
Art:Pohm:ECE:4.00:pohm@ap.a.org:111.222.9999
John:Clark:ECE:2.68:clark@xyz.ab.com:111.111.5555
Nabeel:Ali:EE:3.56:ali@ee.eng.edu:111.111.8888
Tom:Nelson:ECE:3.81:nelson@tn.abc.org:111.111.6666
Pat:King:SS:2.77:king@pk.xyz.org:111.111.7777
Jake:Zulu:CS:3.00:zulu@jz.sa.org:111.111.9999
John:Lee:EE:2.64:jlee@j.lee.com:111.111.2222
Sunil:Raj:ECE:3.36:raj@sr.cs.edu:111.111.3333
Charles:Right:EECS:3.31:right@cr.abc.edu:111.111.4444
Diane:Rover:ECE:3.87:rover@dr.xyz.edu:111.111.5555
Aziz:Inan:EECS:3.75:ainan@ai.abc.edu:111.111.1111
Lu:John:CS:3.06:lu.john@xyz.org:111.333.1111
Lee:Chow:EE:3.74:chow@lc.www.ord:111.333.2222
Adam:Giles:SS:2.54:giles@cric.org:111.333.3333
Andy:John:EECS:3.98:john@aj.ece.edu:111.333.4444
Display lines, with line numbers, records of CS majors.
grep -n '\<CS\>' smallFile
Shell Script:* Pick one of the grep commands that you created above. Put that grep command in a shell script.* The name of the shell script is your choice. Run the shell script.*
Turn in the contents of the shell script and the output of the shell script run.
the shell scripts name is CS_STUDENTS code is
CS_STUDENTS=$(grep -n '\<CS\>' smallFile)
echo $CS_STUDENTS
I get some thing like this
:~> \. CS_STUDENTS
3:Al:Davis:CS:2.63:davis@a.lakers.org:111.222.2222 7:Rick:Marsh:CS:2.34:marsh@a.b.org:111.222.6666 8:James:Adam:CS:2.77:jadam@a.b.org:111.222.7777 14:Jake:Zulu:CS:3.00:zulu@jz.sa.org:111.111.9999 20:Lu:John:CS:3.06:lu.john@xyz.org:111.333.1111
(purposely left out of a code box to get the appearance as close to as I actually got)
I believe I need a out come to look like this
:~> \. CS_STUDENTS
3:Al:Davis:CS:2.63:davis@a.lakers.org:111.222.2222
7:Rick:Marsh:CS:2.34:marsh@a.b.org:111.222.6666
8:James:Adam:CS:2.77:jadam@a.b.org:111.222.7777
14:Jake:Zulu:CS:3.00:zulu@jz.sa.org:111.111.9999
20:Lu:John:CS:3.06:lu.john@xyz.org:111.333.1111
I have tried modifying the shell script several times and no luck
this is only the second shell script I have done what should I change in the shell script
Waubonsee Community College
Sugar Grove Illinois
Professor: Tim Lippold
Linux/UNIX Operating System CIS180
Book being used is Harley Hahn's Guide to Unix and Linux
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).