• Cybersecurity Ops with bash

Cybersecurity Ops with bash - Chapter 7 Solutions

Below are selected solutions for the Chapter 7 workshop questions from Cybersecurity Ops with bash.

Question 1

The following example uses cut to print the first and tenth fields of the access.log file:

cut -d' ' -f1,10 access.log | bash summer.sh | sort -k 2.1 -rn

Replace the cut command with the awk command.


Since the access.log file uses whitespace as a field delimiter, you can use awk to access each field (column) directly using $ and the field number.

Question 3

Use the tr command to replace all of the semicolon characters in tasks.txt with the tab character and print the file to the screen.


Note that the tr command does not read a file directly, but rather accepts input from stdin.

195 views0 comments

Recent Posts

See All