Regex строка в grep аргумент?

Как такую regex строку превратить в аргумент команды grep?
^(?!127)[0-9]{0,3}\.[0-9]{0,3}\.[0-9]{0,3}\.(?!255)[0-9]{0,9}


grep то toybox
usage: grep [-EFrivwcloqsHbhn] [-ABC NUM] [-m MAX] [-e REGEX]... [-MS PATTERN]... [-f REGFILE] [FILE]...

Show lines matching regular expressions. If no -e, first argument is
regular expression to match. With no files (or "-" filename) read stdin.
Returns 0 if matched, 1 if no match found.

-e  Regex to match. (May be repeated.)
-f  File listing regular expressions to match.

file search:
-r  Recurse into subdirectories (defaults FILE to ".")
-M  Match filename pattern (--include)
-S  Skip filename pattern (--exclude)

match type:
-A  Show NUM lines after     -B  Show NUM lines before match
-C  NUM lines context (A+B)  -E  extended regex syntax
-F  fixed (literal match)    -i  case insensitive
-m  match MAX many lines     -v  invert match
-w  whole word (implies -E)  -x  whole line
-z  input NUL terminated

display modes: (default: matched line)
-c  count of matching lines  -l  show matching filenames
-o  only matching part       -q  quiet (errors only)
-s  silent (no error msg)    -Z  output NUL terminated

output prefix (default: filename if checking more than 1 file)
-H  force filename           -b  byte offset of match
-h  hide filename            -n  line number of match
  • Вопрос задан
  • 199 просмотров
Решения вопроса 1
mayton2019
@mayton2019
Bigdata Engineer
Взять в кавычки и добавить -e

Кстати посмотри еще альтернативные способы для выбора шаблона айпишника https://www.regular-expressions.info/ip.html
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы