pipe-combinations

上級
1/10
user@linux:~/workspace$
cat logs/app.log | grep "error" | wc -l

Explanation

Displays file → filters for "error" → counts lines.

1[INFO] 2026-01-13 09:00:00 Application started
2[DEBUG] 2026-01-13 09:00:05 Loading configuration from config/app.conf
3[INFO] 2026-01-13 09:00:10 Database connection established
4[DEBUG] 2026-01-13 09:00:15 Cache initialized (Redis)
5[INFO] 2026-01-13 09:00:20 Server listening on port 3000
6[WARN] 2026-01-13 09:15:30 High memory usage detected: 85%
7[ERROR] 2026-01-13 09:30:45 Failed to process payment: timeout
8[INFO] 2026-01-13 09:31:00 Payment retry successful
9[DEBUG] 2026-01-13 09:45:00 Processed 1523 requests in last hour
10[INFO] 2026-01-13 10:00:00 Daily backup completed