3.3 Sticking to the Script Flashcards
Multiple text processing commands are already built into the terminal, such as?
cut
awk
sed
Using text manipulation commands within bash is preferable to using other programming languages for the following reasons:
Simplicity - Text processing is simpler and easier to learn than programming languages.
Convenience - Text processing is simpler and easier to learn than programming languages.
Compatibility - Text processing commands can easily be
added together to complete more advanced tasks—a complicated task with programming languages.
sed stands for __________?
stream editor
True or False?
sed command reads and edits text, line-by-line from an input stream. It is similar to the familiar find and replace feature in Windows systems.
True
Syntax for sed is:
sed s/(_______)/(___________)/
sed s/(old value)/(replacement value)/
Text Processing Commands manipulate text and simplify complex data by (3):
- Substituting
- Filtering lines of text
- Delimiting text
You need to replace the string ACCESS_ACCEPTED with LOGGED_IN to make the data consistent and allow for both datasets to be analyzed together. What command do you use?
sed
The most basic sed capability is __________.
The most basic sed capability is string replacement.
sed is a text processing utility that can help security professionals __________.
sed is a text processing utility that can help security professionals analyze data.
AWK Operations:
a) __________________
b) __________________
c) __________________
d) __________________
a) Scans a file line by line
b) Splits each input line into fields
c) Compares input line/fields to pattern
d) Performs action(s) on matched lines
AWK command is useful for:
a) __________________
b) __________________
a) Transform data files
b) Produce formatted reports
Explain the awk command
Awk is a scripting language used for manipulating data and generating reports.
The basic syntax of field separation with awk is:
awk -F (_______) ‘{print $(________r)}’
awk -F(delimiter) ‘{print $(field_number)}’
Shell is a terminal program that assists in the interaction between _______ and ________.
Shell is a terminal program that assists in the interaction between user and the terminal.
When a script is run, you can add an argument by placing it _______ the script name.
When a script is run, you can add an argument by placing it after the script name.