|
1 | 1 | #!/bin/bash |
2 | 2 | set -x |
3 | | -my attempt |
| 3 | +#Evan Chan's attempt |
4 | 4 | ############################################ |
5 | 5 | # DSI CONSULTING INC. Project setup script # |
6 | 6 | ############################################ |
@@ -28,21 +28,29 @@ unzip -q rawdata.zip |
28 | 28 | # Complete assignment here |
29 | 29 |
|
30 | 30 | # 1. Create a directory named data |
31 | | - |
| 31 | +mkdir data |
32 | 32 | # 2. Move the ./rawdata directory to ./data/raw |
33 | | - |
| 33 | +mv ./rawdata ./data/raw |
34 | 34 | # 3. List the contents of the ./data/raw directory |
35 | | - |
| 35 | +ls ./data/raw |
36 | 36 | # 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 |
38 | 40 | # 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 |
40 | 43 | # 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/ |
42 | 46 | # 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* |
44 | 50 | # 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 |
46 | 54 |
|
47 | 55 | ########################################### |
48 | 56 |
|
|
0 commit comments