BASH_SRV Telegram 97
🧠 Регулярки на практике: как вытащить IP-адреса из логов

Когда нужно быстро достать все IP-адреса из логов — тебе на помощь приходит grep + регулярные выражения 💪

Пример:


grep -oE '\b([0-9]{1,3}\.){3}[0-9]{1,3}\b' /var/log/nginx/access.log


🔍 Что делает:

-o — выводит только совпадения, без строки целиком
-E — расширенные регулярки
\b([0-9]{1,3}\.){3}[0-9]{1,3}\b — паттерн для IPv4

📌 Пример вывода:


192.168.0.1
10.0.0.55
172.16.100.7


🛡️ Хочешь избавиться от дубликатов?


grep -oE '\b([0-9]{1,3}\.){3}[0-9]{1,3}\b' /var/log/nginx/access.log | sort -u


📁 Подходит для Apache, Nginx, sshd и других логов, где есть IP.

👉@bash_srv
👍7



tgoop.com/bash_srv/97
Create:
Last Update:

🧠 Регулярки на практике: как вытащить IP-адреса из логов

Когда нужно быстро достать все IP-адреса из логов — тебе на помощь приходит grep + регулярные выражения 💪

Пример:


grep -oE '\b([0-9]{1,3}\.){3}[0-9]{1,3}\b' /var/log/nginx/access.log


🔍 Что делает:

-o — выводит только совпадения, без строки целиком
-E — расширенные регулярки
\b([0-9]{1,3}\.){3}[0-9]{1,3}\b — паттерн для IPv4

📌 Пример вывода:


192.168.0.1
10.0.0.55
172.16.100.7


🛡️ Хочешь избавиться от дубликатов?


grep -oE '\b([0-9]{1,3}\.){3}[0-9]{1,3}\b' /var/log/nginx/access.log | sort -u


📁 Подходит для Apache, Nginx, sshd и других логов, где есть IP.

👉@bash_srv

BY Bash Советы




Share with your friend now:
tgoop.com/bash_srv/97

View MORE
Open in Telegram


Telegram News

Date: |

How to Create a Private or Public Channel on Telegram? Among the requests, the Brazilian electoral Court wanted to know if they could obtain data on the origins of malicious content posted on the platform. According to the TSE, this would enable the authorities to track false content and identify the user responsible for publishing it in the first place. Members can post their voice notes of themselves screaming. Interestingly, the group doesn’t allow to post anything else which might lead to an instant ban. As of now, there are more than 330 members in the group. In the “Bear Market Screaming Therapy Group” on Telegram, members are only allowed to post voice notes of themselves screaming. Anything else will result in an instant ban from the group, which currently has about 75 members. Telegram iOS app: In the “Chats” tab, click the new message icon in the right upper corner. Select “New Channel.”
from us


Telegram Bash Советы
FROM American