File tree Expand file tree Collapse file tree
02_activities/assignments Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,21 +28,30 @@ unzip -q rawdata.zip
2828# Complete assignment here
2929
3030# 1. Create a directory named data
31+ mkdir -p data
3132
3233# 2. Move the ./rawdata directory to ./data/raw
34+ mv rawdata data/raw
3335
3436# 3. List the contents of the ./data/raw directory
37+ echo " Contents of ./data/raw:"
38+ ls -la data/raw
3539
3640# 4. In ./data/processed, create the following directories: server_logs, user_logs, and event_logs
41+ mkdir -p data/processed/{server_logs,user_logs,event_logs}
3742
3843# 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+ find data/raw -maxdepth 1 -type f -name ' *server*.log' -print -exec cp {} data/processed/server_logs/ \;
3945
4046# 6. Repeat the above step for user logs and event logs
47+ find data/raw -maxdepth 1 -type f -name ' *user*.log' -print -exec cp {} data/processed/user_logs/ \;
48+ find data/raw -maxdepth 1 -type f -name ' *event*.log' -print -exec cp {} data/processed/event_logs/ \;
4149
4250# 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+ find data/raw data/processed/user_logs -maxdepth 1 -type f -name ' *ipaddr*' -print -delete
4352
4453# 8. Create a file named ./data/inventory.txt that lists all the files in the subfolders of ./data/processed
45-
54+ find data/processed -mindepth 2 -type f | sort > data/inventory.txt
4655
4756# ##########################################
4857
You can’t perform that action at this time.
0 commit comments