From b9b7945a301626bd0ca171af0bebc3e1660b0d4e Mon Sep 17 00:00:00 2001 From: febin1104 <91665618+febin1104@users.noreply.github.com> Date: Sun, 17 Jul 2022 14:15:39 +0530 Subject: [PATCH] Create script1.sh --- task-1/team-11/script1.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 task-1/team-11/script1.sh diff --git a/task-1/team-11/script1.sh b/task-1/team-11/script1.sh new file mode 100644 index 0000000..45fecfb --- /dev/null +++ b/task-1/team-11/script1.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +LOG_FILE="access.log" +function login_attempt() { + while read line; do + day=$(echo $line | awk '{print substr($4,2,11)}') + ip=$(echo $line | awk '{print $1}') + echo 'On' $day', a login attempt was made, with the request coming from the IP' $ip + done < $LOG_FILE +} +login_attempt