Regular expressions — patterns for grep, sed and awk
cheat sheet · Ubuntu 24.04 · GNU grep 3.11 · GNU sed 4.9 https://lab.dimsanych.ru/en/wiki/regex/Cheat sheet
-
grep -i 'error' app.logignore case -
grep -E 'error|fail' app.logeither word -
grep 'error\|fail' app.logthe same in GNU basic syntax -
grep -w 'err' app.loga whole word: not terror -
grep -oE '\berr\b' app.logthe same with word boundaries -
grep -E '^[0-9]+$' filea line of digits only -
grep -F '10.20.0.15' fileliterally, no special characters -
sed -E 's/^(\w+) *= */\1=/' app.inigroup \1 in a replacement