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.

Cybersecurity Ops with bash - Chapter 7 Solutions

  • Writer: Cybersecurity Ops with bash
    Cybersecurity Ops with bash
  • Apr 1, 2019
  • 1 min read

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.


Answer


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.


Answer


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


 
 
 

Comments


bottom of page