top of page
book of spells.webp

Start your journey towards mastering the CLI with our FREE Command Line Book of Spells.

By entering your email address you agree to receive emails from Command Line Wizardry. We'll respect your privacy and you can unsubscribe at any time.

  • Writer's pictureCybersecurity 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 | 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.

583 views0 comments
bottom of page