Skip to content

Commit 4d49eb7

Browse files
贺思涵贺思涵
authored andcommitted
Complete the first part of the shell module assignment. --Sihan
1 parent 871d0a5 commit 4d49eb7

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

02_activities/assignments/assignment.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,35 @@ 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
34+
mv ./rawdata ./data/raw
3335

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

3639
# 4. In ./data/processed, create the following directories: server_logs, user_logs, and event_logs
40+
mkdir ./data/processed
41+
cd ./data/processed
42+
mkdir server_logs user_logs event_logs
43+
cd ..
44+
cd ..
3745

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

4049
# 6. Repeat the above step for user logs and event logs
50+
cp ./data/raw/*.log ./data/processed/user_logs/
51+
cp ./data/raw/*.log ./data/processed/event_logs/
4152

4253
# 7. For user privacy, remove all files containing IP addresses (files with "ipaddr" in the filename) from ./data/raw and ./data/processed/user_logs
54+
rm ./data/raw/*ipaddr*
55+
rm ./data/processed/user_logs/*ipaddr*
4356

4457
# 8. Create a file named ./data/inventory.txt that lists all the files in the subfolders of ./data/processed
58+
touch ./data/inventory.txt
59+
ls ./data/processed > ./data/inventory.txt
4560

4661

4762
###########################################

0 commit comments

Comments
 (0)