BASH_SRV Telegram 113
🔍 10 полезных регулярных выражений для админов

Регулярки — мощный инструмент для поиска и обработки текста в Linux.


# 1. Найти все IP-адреса в файле
grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' file.log

# 2. Найти строки с email-адресами
grep -E '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}' file.txt

# 3. Удалить пустые строки
sed -i '/^$/d' file.txt

# 4. Найти строки, начинающиеся с #
grep -E '^#' file.conf

# 5. Найти строки, не содержащие слово ERROR
grep -Ev 'ERROR' file.log

# 6. Заменить все цифры на символ *
sed -E 's/[0-9]/*/g' file.txt

# 7. Удалить комментарии и пустые строки
grep -Ev '^\s*#|^\s*$' file.conf

# 8. Найти все URL
grep -Eo 'https?://[^ ]+' file.txt

# 9. Найти строки длиной больше 100 символов
grep -E '.{100,}' file.txt

# 10. Извлечь доменные имена из email
grep -Eo '@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}' file.txt


💡Тестируйте регулярки в реальном времени с grep -E или онлайн-сервисами типа regex101.com.

👉@bash_srv
👍191



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

🔍 10 полезных регулярных выражений для админов

Регулярки — мощный инструмент для поиска и обработки текста в Linux.


# 1. Найти все IP-адреса в файле
grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' file.log

# 2. Найти строки с email-адресами
grep -E '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}' file.txt

# 3. Удалить пустые строки
sed -i '/^$/d' file.txt

# 4. Найти строки, начинающиеся с #
grep -E '^#' file.conf

# 5. Найти строки, не содержащие слово ERROR
grep -Ev 'ERROR' file.log

# 6. Заменить все цифры на символ *
sed -E 's/[0-9]/*/g' file.txt

# 7. Удалить комментарии и пустые строки
grep -Ev '^\s*#|^\s*$' file.conf

# 8. Найти все URL
grep -Eo 'https?://[^ ]+' file.txt

# 9. Найти строки длиной больше 100 символов
grep -E '.{100,}' file.txt

# 10. Извлечь доменные имена из email
grep -Eo '@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}' file.txt


💡Тестируйте регулярки в реальном времени с grep -E или онлайн-сервисами типа regex101.com.

👉@bash_srv

BY Bash Советы




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

View MORE
Open in Telegram


Telegram News

Date: |

Ng was convicted in April for conspiracy to incite a riot, public nuisance, arson, criminal damage, manufacturing of explosives, administering poison and wounding with intent to do grievous bodily harm between October 2019 and June 2020. While some crypto traders move toward screaming as a coping mechanism, many mental health experts have argued that “scream therapy” is pseudoscience. Scientific research or no, it obviously feels good. A few years ago, you had to use a special bot to run a poll on Telegram. Now you can easily do that yourself in two clicks. Hit the Menu icon and select “Create Poll.” Write your question and add up to 10 options. Running polls is a powerful strategy for getting feedback from your audience. If you’re considering the possibility of modifying your channel in any way, be sure to ask your subscribers’ opinions first. The initiatives announced by Perekopsky include monitoring the content in groups. According to the executive, posts identified as lacking context or as containing false information will be flagged as a potential source of disinformation. The content is then forwarded to Telegram's fact-checking channels for analysis and subsequent publication of verified information. The main design elements of your Telegram channel include a name, bio (brief description), and avatar. Your bio should be:
from us


Telegram Bash Советы
FROM American