Top "Grep" questions

grep is a command-line text-search utility originally written for Unix.

Read expression for grep from standard input

How can I make grep read the expression from standard input (stdin)? For example (the following doesn't work): grep -i …

grep stdin
How to truncate long matching lines returned by grep or ack

I want to run ack or grep on HTML files that often have very long lines. I don't want to …

grep unix ack
How to exclude certain directories/files from git grep search

Is there a way to exclude certain paths/directories/files when searching a git repository using git grep? Something similar …

git grep
total size of group of files selected with 'find'

For instance, I have a large filesystem that is filling up faster than I expected. So I look for what's …

shell scripting find grep filesize
Is \d not supported by grep's basic expressions?

This does not generate any output. How come? $ echo 'this 1 2 3' | grep '\d\+' But these do: $ echo 'this 1 2 3…

linux grep
Pattern matching digits does not work in egrep?

Why can't I match the string "1234567-1234567890" with the given regular expression \d{7}-\d{10} with egrep from the shell …

regex grep character-class
Tarballing without Git metadata

My source tree contains several directories which are using Git source control, and I need to tarball the whole tree …

find packaging tar xargs grep
Simple TextWrangler Grep Replace

I am trying to replace all h2 tags containing the class "title" with h1: <h2 class="title">Things&…

regex search grep aptana textwrangler
Print lines in one file matching patterns in another file

I have a file with more than 40.000 lines (file1) and I want to extract the lines matching patterns in file2 (…

unix sed awk grep extract
How does grep run so fast?

I am really amazed by the functionality of GREP in shell, earlier I used to use substring method in java …

unix grep