IT 244: Introduction to Linux/Unix
Homework 3

Due

Sunday, September 22nd 11th at 11:59 PM

What You Need to Do

Setup

Specification

.plan


20 points

hw3.sh


80 points
  1. Go to the directory /home/ghoffman/course_files/it244_files.
    Using grep and pipes, | on the file red_sox.txt, select all the Red Sox away games where they won, except for the games they played against the Orioles
    Away games are indicated by the @ symbol
  2. Print to the terminal the contents of foo.txt, selecting only those lines with the word "foo" as a whole word
    In other words, "foo" must NOT appear as part of another string, like "foobbbbbbbb".
    There is an option for grep that tells it to only match the string when it appears as a word, not as part of a bigger string
    Check the man page for grep to find this option
    Don't call the man page from within your shell script.
  3. Use head and tail to print to the terminal lines 11 through 15 in numbers1.txt
  4. Use sort to print to the terminal the contents of numbers1.txt in reverse numerical order
  5. Use diff to print to the terminal the differences between numbers1.txt and numbers2.txt in a human readable format
  6. Consult the man page for date, then use this command to print to the terminal the date in the format yyyy-mm-dd.
    Don't call the man page from within your shell script.
  7. Print to the terminal the location of the executable file for perl, a scripting language. The command you use should only work for executable files
  8. Run finger on your Unix username to print to the terminal the information you entered in your .plan file

Testing

Output

$ bash hw3.sh 
2011-07-02      Red Sox @  Astros       Win 7-5
2011-07-03      Red Sox @  Astros       Win 2-1
2011-07-16      Red Sox @  Rays         Win 9-5
2011-07-17      Red Sox @  Rays         Win 1-0
2011-07-30      Red Sox @  White Sox    Win 10-2
2011-07-31      Red Sox @  White Sox    Win 5-3
foo
foo
11
12
13
14
15
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
1							      <
2							      <
3							      <
4								4
5								5
6								6
7								7
8								8
9								9
10								10
							      >	11
							      >	11
11								11
12								12
13								13
14								14
15								15
16								16
17								17
18								18
19								19
20								20
2022-09-27
/usr/bin/perl
Login: ghoffman       			Name: Glenn Hoffman
Directory: /home/ghoffman           	Shell: /bin/bash
On since Tue Sep 27 10:52 (EDT) on pts/30 from 172.18.20.39
   4 seconds idle
On since Tue Sep 27 12:37 (EDT) on pts/33 from 172.18.20.39
   5 minutes 58 seconds idle
Mail forwarded to glenn.hoffman@umb.edu

New mail received Fri Jul  8 13:31 2022 (EDT)
     Unread since Fri Jul  8 13:30 2022 (EDT)
Plan:
Office:		Science 3-92A (Pterosaur poster on door)
Office Hours:   Tuesday & Thursday, 12:30 - 1:30 PM and 5:30 - 6:30
Classes:	IT 244-11    TuTh 11:00 - 12:15		McCormack M03-0430
		IT 116-11    TuTh  2:00 -  3:15		McCormack M03-0430
		IT 117-11    TuTh  4:00 -  5:15		Wheatley W01-0061
Home Address:  	40 Central Street     
               	Somerville, MA 02143
               	617-821-3936 (9am - 9pm only)

Copyright © 2022 Glenn Hoffman. All rights reserved. May not be reproduced without permission.