‘Awk’ and ‘sed’ are powerful text processing tools in Bash scripting. Awk processes lines of input based on patterns, performing actions for each match. A basic syntax is: awk ‘/pattern/ {action}’ file. The pattern is a regular expression; if it matches a line, the action is executed.
Sed (stream editor) performs transformations on text using a script of commands. Its basic syntax is: sed ‘s/pattern/replacement/’ file. This replaces the first instance of the pattern per line with the replacement.
Both can be used within scripts by invoking them as you would from the command line, enclosed in backticks or $(). For example, to replace all instances of “foo” with “bar” in a variable using sed: myVar=$(echo $myVar | sed ‘s/foo/bar/g’).