Ravindra BagaleCourses & study guides मराठी Track your progress

Ravi Sir's Cyber Security Cards › Revision Cards

Text Processing: awk and sed

Text Processing: awk and sed awk splits each line into columns: $1, $2 and so on. sed finds and replaces text. Both are Linux text tools. awk '{print $1}' access.log | sort | uniq -c | sort -nr | head This lists the IPs that sent the most requests to a web server. In a brute-force or scan, the attac

Text Processing: awk and sed awk splits each line into columns: $1, $2 and so on. sed finds and replaces text. Both are Linux text tools. awk '{print $1}' access.log | sort | uniq -c | sort -nr | head This lists the IPs that sent the most requests to a web server. In a brute-force or scan, the attac
Text Processing: awk and sed · Download PNG
Read card text

What this card says

What it is

awk splits each line into columns: $1, $2 and so on. sed finds and replaces text.

Both are Linux text tools.

Example

awk '{print $1}' access.log | sort | uniq -c | sort -nr | head

This lists the IPs that sent the most requests to a web server.

Why it matters for security

In a brute-force or scan, the attacker’s IP jumps to the top of that list in seconds.

Common mistake

Running sed -i (edit in place) on a live config first.

Run it without -i, check the output, then add -i.

Learn more in the lesson: 6.3 Text Processing: awk and sed

See all Ravi Sir's Cyber Security Cards