Text Processing
grep
Option
Function
grep "<pattern1>\|<pattern2>" <file>
grep -e "<pattern1>" -e "<pattern2>" <file>echo "<string>" | grep -q -E "<substring>"grep -oP 'Host:\s*\K[^\s;]*' "${NMAP_FILE}"awk
# Extract the first field
awk '{print $1}' <file>
# Extract multiple fields
awk '{print $1,$4}' <file># Start from the 3rd line and print the last field
awk 'NR > 3 {print $NF}' <file># For each input line, print the entire line and add a space after it
awk '{printf "%s ", $0}'# Add a new line character after each line
awk '{printf "%s ", $0} END {print ""}'sed
Option
Description
tr
printf
Format Specifier
Description
tee
Last updated