Tagged Questions

grep is a command-line tool for searching text patterns in files

learn more… | top users | synonyms

1
vote
1answer
24 views

grep directory names, filenames, and contents all at one?

I'm writing a module for drupal. Its functionality is contingent on the directory name, certain file names, and function names being identical. I'm troubleshooting now, and I wanted to to a search ...
2
votes
2answers
59 views

How to group grep results?

I have a file that contains results grouped into categories. For example: checking results for $var here are some results1 for $var status ok here are some results2 for $var status ok here are some ...
1
vote
5answers
138 views

Display output to console while grep is used

In vim I use the following command to compile a tex file: pdflatex\ \-file\-line\-error\ \-shell\-escape\ \-interaction=nonstopmode\ $*\\\|\ grep\ \-P\ ':\\d{1,5}:\ ' this works in terms of getting ...
1
vote
1answer
58 views

grep - recognize carriage return as new line [closed]

I want to search a webserver running unix for php-files containing a specific string. Usually I use these commands to accomplish this: find . -name "*.php" -print0 | xargs -0 grep -H -i "the string ...
1
vote
3answers
55 views

Omitting results containing '//' from grep searches

I'm trying to search a substantial C++ codebase for a single line that is outputing text to the terminal that I'd like to suppress. I have grepped for std::cout and have had around 40 different files ...
2
votes
2answers
34 views

Grep 'OR' regex problem

I am trying to use grep with a regex to find lines in a file that match 1 of 2 possible strings. Here is my grep: $ grep "^ID.*(ETS|FBS)" my_file.txt The above grep returns no results. However if I ...
0
votes
1answer
45 views

Printing file content with grep

Is it possible to print to the console all file content using only grep command? (wihtout cat, less, echo, more...)
4
votes
1answer
57 views

How can I search/browse in some process's memory?

I'm using MacOS X 10.7 and I'm not very familiar with unix. Is there a command for a search in some process's memory for a string?
1
vote
1answer
17 views

What special characters does grep parse by default? [closed]

Possible Duplicate: In a regular expression, which characters need escaping? I know there is the -E flag which treats the "search term" as a regular expression. However, it seems that even ...
10
votes
3answers
175 views

How can I redirect matching lines to a file, and non-matching lines to a different file?

Is there a script/program/utility already available for the following requirement in a optimised way? someCommand | tee >(grep "pattern" > LinesWhichMatch) | grep -v "pattern" > ...
2
votes
4answers
64 views

How to search for a word in entire content of a directory in linux

need to search for something in entire content I am trying: find . | xargs grep word I get error: xargs: unterminated quote How to achieve this? Thanks.
2
votes
1answer
45 views

How to show lines after each grep match until other specific match?

I know that by using the "-A NUM" switch I can print specific number of trailing lines after each match. I am just wondering if it's possible to print trailing lines until a specific word is found ...
1
vote
1answer
68 views

Diff similar lines

I'd like to print a list of lines where the first word in two files is identical, and the rest of the words are not. Some complicated mess with comm, grep and cut would be possible, but hopefully ...
1
vote
2answers
38 views

Using grep to read a paragraph on Solaris

How can I grep a paragraph from a file in the Solaris operating system? I tried the -p option used in AIX, but it's not useful in Solaris. grep -p Accept is not working in Solaris. Is there any other ...
3
votes
3answers
99 views

How do I grep without leading whitespaces?

I'm greping through a large codebase, and leading whitespaces and tabulation seem to be quite annoying. Is there any way to get rid of it? grep -R "something" ./ E.g, instead of: foo/bar.cpp: ...

1 2 3 4 5 7
15 30 50 per page