Skip to content

Commit 6df0827

Browse files
author
Zichuan Gan
committed
Complete assignment.sh data organization tasks
1 parent 1905152 commit 6df0827

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

02_activities/assignments/assignment.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,31 @@ unzip -q rawdata.zip
2828
# Complete assignment here
2929

3030
# 1. Create a directory named data
31+
mkdir data
3132

3233
# 2. Move the ./rawdata directory to ./data/raw (eg. move it into ./data and rename it to raw)
34+
mv rawdata data/raw
3335

3436
# 3. List the contents of the ./data/raw directory
37+
ls data/raw
3538

3639
# 4. Create the directory ./data/processed,
3740
# then create the following sub-directories within it: server_logs, user_logs, and event_logs
41+
mkdir -p data/processed/server_logs data/processed/user_logs data/processed/event_logs
3842

3943
# 5. Copy all server log files (files with "server" in the name AND a .log extension) from ./data/raw to ./data/processed/server_logs
44+
cp data/raw/*server*.log data/processed/server_logs/
4045

4146
# 6. Repeat the above step for user logs and event logs
47+
cp data/raw/*user*.log data/processed/user_logs/
48+
cp data/raw/*event*.log data/processed/event_logs/
4249

4350
# 7. For user privacy, remove all files containing IP addresses (files with "ipaddr" in the filename) from ./data/raw and ./data/processed/user_logs
51+
rm -f data/raw/*ipaddr*
52+
rm -f data/processed/user_logs/*ipaddr*
4453

4554
# 8. Create a file named ./data/inventory.txt that lists all the files in the subfolders of ./data/processed
46-
55+
find data/processed -type f > data/inventory.txt
4756

4857
###########################################
4958

0 commit comments

Comments
 (0)