Skip to content

Commit c22952a

Browse files
author
Liza Igoshina
committed
Completed shell module assignment 1
1 parent 4446d15 commit c22952a

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

02_activities/assignments/assignment.sh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
d#!/bin/bash
22
set -x
33

44
############################################
@@ -28,22 +28,26 @@ 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 (eg. move it into ./data and rename it to raw)
33-
33+
mv ./rawdata ./data/raw
3434
# 3. List the contents of the ./data/raw directory
35-
35+
ls ./data/raw
3636
# 4. Create the directory ./data/processed,
37+
mkdir ./data/processed
3738
# then create the following sub-directories within it: server_logs, user_logs, and event_logs
38-
39+
mkdir ./data/processed/server_logs .data/processed/user_logs ./data/processed/event_logs
3940
# 5. Copy all server log files (files with "server" in the name AND a .log extension) from ./data/raw to ./data/processed/server_logs
40-
41+
cp ./data/raw/*server*.log ./data/processed/server_logs/
4142
# 6. Repeat the above step for user logs and event logs
42-
43+
cp ./data/raw/*user*.log ./data/processed/user_logs/
44+
cp ./data/raw/*event*.log ./data/processed/event_logs/
4345
# 7. For user privacy, remove all files containing IP addresses (files with "ipaddr" in the filename) from ./data/raw and ./data/processed/user_logs
44-
46+
rm ./data/raw/*ipaddr*
47+
rm ./data/processed/*/*ipaddr*
4548
# 8. Create a file named ./data/inventory.txt that lists all the files in the subfolders of ./data/processed
46-
49+
ls ./data/processed/* > ./data/inventory.txt
50+
cat ./data/inventory.txt
4751

4852
###########################################
4953

0 commit comments

Comments
 (0)