Skip to content

Commit 2713223

Browse files
committed
Create data directory and subdirectories. Copy log files from one to other folders. Remove IP addresses from file names. Create file that lists all files in the subfolders.
1 parent 3e6aeb3 commit 2713223

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

02_activities/assignments/assignment.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,27 @@ unzip -q rawdata.zip
3131
mkdir data
3232

3333
# 2. Move the ./rawdata directory to ./data/raw
34+
mv ./rawdata ./data/raw
3435

3536
# 3. List the contents of the ./data/raw directory
37+
ls ./data/raw
3638

3739
# 4. In ./data/processed, create the following directories: server_logs, user_logs, and event_logs
40+
mkdir -p ./data/processed/server_logs ./data/processed/user_logs ./data/processed/event_logs
3841

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

4145
# 6. Repeat the above step for user logs and event logs
46+
cp ./data/raw/*user*.log ./data/processed/user_logs
47+
cp ./data/raw/*event*.log ./data/processed/event_logs
4248

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

4553
# 8. Create a file named ./data/inventory.txt that lists all the files in the subfolders of ./data/processed
46-
54+
ls -R ./data/processed > ./data/inventory.txt
4755

4856
###########################################
4957

0 commit comments

Comments
 (0)