Cybersecurity Ops with bash - Chapter 6 Solutions
Below are selected solutions for the Chapter 6 workshop questions from Cybersecurity Ops with bash.
Given the following file tasks.txt, use the cut command to extract columns 1 (Image Name), 2 (PID), and 5 (Mem Usage).
Image Name;PID;Session Name;Session#;Mem Usage
System Idle Process;0;Services;0;4 K
You can use the cut command's -d option to specify the semicolon for the delimiter, and the -f option to specify the fields (columns) to extract:
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.