## Grep (Global Regular Expression Print)

Grep is the search tool for **content**. It finds text *inside* files.

### Basic Usage
*   `grep "error" /var/log/syslog`: Show me lines containing "error".
*   `grep -i "pass" file.txt`: Case insensitive (finds "Pass", "PASS").
*   `grep -r "apikey" /var/www/html/`: **Recursive**. Search every file in the website folder for "apikey".

### Pipes (`|`)
The pipe takes the output of the Left command and feeds it to the Right command. It is the most powerful feature of Linux.

*   `cat huge_log.txt | grep "IP: 1.2.3.4"`
    *   1. Cat dumps the file.
    *   2. Pipe catches it.
    *   3. Grep filters it.
*   `ls -la | grep "Aug"`: Show files modified in August.
*   `history | grep "ssh"`: Search my command history for SSH connections.

### Real World Scenario: Log Analysis
You are investigating a web server access log.
1.  `cat access.log | grep "404"` (Find failures).
2.  `cat access.log | grep "admin.php"` (Find attempts to access admin).
3.  `cat access.log | awk '{print $1}' | sort | uniq -c | sort -nr`: (Count requests by IP address. The "freq" command stack).