Tab 1: List of logins on Mar 13
Best Command:
grep "Mar 13" log.txt
Reasoning:
This command searches for lines in log.txt containing "Mar 13", which matches the date shown in the output. The result shows all login records for that day.
Tab 2: List of logins on Mar 12 (UPPERCASE) including REBOOT entries
Best Command:
awk '{ print toupper($0) }' log.txt
Reasoning:
All lines in the output are in UPPERCASE, including the word "REBOOT". This command converts every character in each line to uppercase, which matches the output format exactly.
Tab 3: List of unique usernames (sorted) including 'reboot'
Best Command:
awk '{ print $1 }' log.txt | sort | uniq
Reasoning:
This command extracts the first column (the username), sorts them, and removes duplicates, resulting in a list of unique usernames in alphabetical order. The output matches exactly.
Tab 1 shows logins for "Mon Mar 13" –> grep "Mar 13" log.txt
Tab 2 shows all entries in uppercase (including "REBOOT") for "Sun Mar 12" –> awk '{ print toupper($0) }' log.txt
Tab 3 shows unique usernames in sorted order –> awk '{ print $1 }' log.txt | sort | uniq
grep "Mar 13" log.txt
awk '{ print toupper($0) }' log.txt
awk '{ print $1 }' log.txt | sort | uniq
Extracts just the username from each log entry, sorts them, and removes duplicates for a clean list.
Submit