Skip to content

Latest commit

 

History

History
51 lines (35 loc) · 604 Bytes

grep.md

File metadata and controls

51 lines (35 loc) · 604 Bytes

grep

References

Commands

grep --help

Tips

Search in Files

grep -lrnw '[/path/to/files]' -e '[text]'

Before and After

grep -B 10 -A 10 -i 'john doe' ./users.json

Highlight

echo 'My name is John Doe!' | grep --color -i 'john doe'

Filter

cat << EOF | grep -i --line-buffered doe
John Doe
Jane Doe
Richard Roe

EOF

Docker Logs Filter

#
docker logs [container-name] 2> >(grep '[text]')
#
docker logs [container-name] 2>&1 | grep '[text]'