|
- linux - What is the point of grep -q - Stack Overflow
Moreover, this is a lot faster than a regular grep invocation, since it can exit immediately when the first match is found, rather than needing to unconditionally read (and write) to the end of file
- Whats the difference between grep -r and -R - Stack Overflow
In the man page: -r Read all files under each directory, recursively, following symbolic links only if they are on the command line what exactly does "being on the command line" means? T
- regex - Using the star sign in grep - Stack Overflow
grep * means "0 or more", and grep is greedy by default Note that in grep basic regular expressions the metacharacters ?, + , { , | , ( , and ) lose their special meaning
- UNIX grep command (grep -v grep) - Stack Overflow
11 grep when used with ps -ef also outputs the grep used for filtering the output of ps -ef grep -v grep means that do not include the grep used for filtering in the command output You can also avoid grep in the results by using a regex pattern For example, in the following example you won't need a grep -v grep to avoid grep in the output:
- How can I use grep to find a word inside a folder?
165 grep -nr string my_directory Additional notes: this satisfies the syntax grep [options] string filename because in Unix-like systems, a directory is a kind of file (there is a term "regular file" to specifically refer to entities that are called just "files" in Windows)
- regex - How can I exclude one word with grep? - Stack Overflow
Here grep will try to list all the occurrences of 'wanted_pattern' in all the files from within currently directory and pass it to second grep to filter out the 'unwanted_pattern' '|' - pipe will tell shell to connect the standard output of left program (grep -r 'wanted_pattern' *) to standard input of right program (grep -v 'unwanted_pattern')
- Whats the difference between grep -e and grep -E
As you mentioned, grep -E is for extended regular expressions whereas -e is for basic regular expressions From the man page: EDIT: As Jonathan pointed out below, grep -e "specifies that the following argument is (one of) the regular expression (s) to be matched " Basic vs Extended Regular Expressions In basic regular expressions the meta-characters ?, +, {, |, (, and ) lose their special
- How can I grep for a filename instead of the contents of a file?
grep is used to search within a file to see if any line matches a given regular expression However, I have this situation - I want to write a regular expression that will match the filename itself (and not the contents of the file)
|
|
|