Skip to content

Commit 5416f4a

Browse files
committed
First attempt at Assignment 1 by Evan Chan
1 parent 086c2ae commit 5416f4a

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

02_activities/assignments/assignment.sh

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
set -x
3-
my attempt
3+
#Evan Chan's attempt
44
############################################
55
# DSI CONSULTING INC. Project setup script #
66
############################################
@@ -28,21 +28,29 @@ unzip -q rawdata.zip
2828
# Complete assignment here
2929

3030
# 1. Create a directory named data
31-
31+
mkdir data
3232
# 2. Move the ./rawdata directory to ./data/raw
33-
33+
mv ./rawdata ./data/raw
3434
# 3. List the contents of the ./data/raw directory
35-
35+
ls ./data/raw
3636
# 4. In ./data/processed, create the following directories: server_logs, user_logs, and event_logs
37-
37+
mkdir ./data/processed
38+
cd ./data/processed
39+
mkdir server_logs user_logs event_logs
3840
# 5. Copy all server log files (files with "server" in the name AND a .log extension) from ./data/raw to ./data/processed/server_logs
39-
41+
cp ../raw/server*.log server_logs/
42+
#note to self: since we cd'd into processed, we need .. to go back out in the tree or the parent where as ./ indicates the relative
4043
# 6. Repeat the above step for user logs and event logs
41-
44+
cp ../raw/user*.log user_logs/
45+
cp ../raw/event*.log event_logs/
4246
# 7. For user privacy, remove all files containing IP addresses (files with "ipaddr" in the filename) from ./data/raw and ./data/processed/user_logs
43-
47+
rm ../raw/user_ipaddr*
48+
rm ../raw/ipaddr*
49+
rm user_logs/user_ipaddr*
4450
# 8. Create a file named ./data/inventory.txt that lists all the files in the subfolders of ./data/processed
45-
51+
touch ../inventory.txt
52+
find . -type f > ../inventory.txt
53+
#technically, mv is possible and the question does not specify whether we mv or cp
4654

4755
###########################################
4856

0 commit comments

Comments
 (0)