grep a Unix command-line utility which searches input passed to it for lines matching a regular expression, and prints the results.

learn more… | top users | synonyms

0
votes
0answers
10 views

Grep errors after fink installation on Mac OS X 10.9.5

I just installed fink on my Mac. At the end of installation I received the following error message (also including the last several lines above the error): checking how to run the C preprocessor... ...
0
votes
2answers
2k views

Why escaped single quote doesn't work in grep?

I am trying to match a string: * * * * * /usr/local/bin/growlnotify -t 'helloTitle' -m 'helloMessage' -n 'myApp' -sw with: crontab -l | grep '^[^#].*/usr/local/bin/growlnotify.*\-n \'myApp\'.*$' ...
1
vote
1answer
21 views

Easily print out a spaces between larger data outputs in bash

I'm grepping through a very large web directory, and when I do multiple greps in a row, when scrolling up, it is difficult to tell when one result ends and an other one starts. I tried just clear, ...
2
votes
3answers
2k views

how can I grep a hex value in string in a binary file

I have a binary file like this (open in emacs hex mode): How can grep if hex values '22081b00081f091d2733170d123f3114' exists in file? 00000000: 2b08 1b00 1418 0825 0407 3830 271d 170d ...
0
votes
1answer
22 views

How to use the awk to print the output

This command nstats gives me output like below. How can I use awk or grep to give me the uptime with only days on it? I cannot use the "" to get the output. HOSTNAME LOAD MEMORY SWAP PROCS ...
1
vote
3answers
39 views

How to use grep on a variable or string?

I'm writing a bash script and I need to check if a file name has a number at the end (after a period) and if so get it, but I can't figure out how to use regex on a variable or string. I was able to ...
0
votes
1answer
24 views

I'm trying to mirror dns queries generated by TCPDUMP filter and replay them with dig or any other utility

I'm not a very experienced script writer at all. I did find some useful hints in generating an stdout from tcpdump that generates a live feed if you will which is what I want, the problem is handling ...
1
vote
1answer
26 views

Grep on specific directory structures

What I'm trying to accomplish: Search for the regular expression \b\$\w+ in all .php files that fall under this directory structure: foo/templates/*.php bar/templates/*.php ...
0
votes
0answers
29 views

I broke grep, and I need it to work in order to configure X11 (XQuartz) to run Wireshark. How can I mend it?

This was an X-post from apple.se, now deleted there, since it hadn't attracted any sufficient help. I need to work with Wireshark for my Web Programming class, so any help will be most appreciated. ...
1
vote
1answer
12 views

How to make SlickEdit's search results look like Notepad++

I use "find in files" (grep) and the search results very often for navigating code. Currently I use both SlickEdit and Notepad++ at different times. Both applications do this "find in files" but ...
53
votes
9answers
100k views

Command prompt (Windows 7) grep equivalent?

Is there a command prompt (Windows 7) grep equivalent? That is, I want to filter out the results of a command: Bash use: ls | grep root What would it be from a Windows command prompt?
2
votes
2answers
13k views

Filter/grep some output only by certain column?

How can I filter some output only by certain column? I need something like this: tail -f logs/access_log | grep -v "200" --only-in-column=1 So I want to see only lines that don't have string '200' ...
1
vote
2answers
32 views

Script to join columns

I have two files: The output of yum list installed which is now yum_installed and yum list updates now as yum_updates What I need is to basically join the two files somehow but ONLY based on the ...
10
votes
11answers
12k views

Monitoring a file until a string is found

I am using tail -f to monitor a log file that is being actively written to. When a certain string is written to the log file, I want to quit the monitoring, and continue with the rest of my script. ...
0
votes
3answers
199 views

Count all files without using find

How can I count all files without using find and only grep? I tried using ls recursively but how can I pipe that to grep and count files?
2
votes
4answers
70 views

grep “*.JPG” not returning entries ending in .JPG

When I run this command ls -l Documents/phone_photo_vids, I get 100s of entries in the following format. Notice the endings of the images are either PNG or JPG -rw-r--r-- 1 moi staff 189280 ...
-1
votes
1answer
45 views

Cygwin grep, no such file or directory

This is the first time I'm using Cygwin and I have not so much experience with scripts. I'm trying to grep words out of a XML document and need to get them counted. When I press enter I get a ...
0
votes
0answers
36 views

Remove grep's line number output in Redhat 5.9

I havent used RH 5.9 until now. I started with 6 but we have some 5.9 servers. The syntax with 5.9 is a bit different with some things. grep for example will output a number line before the actual ...
0
votes
0answers
47 views

Get all inactive users on system with 'lastlog' on Redhat 5.9

I need a script that will basically give me the listing of usernames that have been inactive on a system for 90+ days. I use the lastlog command but it seems a bit tricky to try to grep out the time. ...
17
votes
5answers
10k views

Excluding grep from process list

I have cobbled together a command to return the process ID of a running daemon: ps aux | grep daemon_name | awk "{ print \$2 }" It works perfectly and returns the PID, but it also returns a second ...
0
votes
2answers
50 views

any way to run grep backwards, i.e. from the end of the file and up?

i have a 70G+ log file, and i'd like the most recent entries (apache log append new items at the end) that match a pattern. i can either: run grep | tail or run tail | grep option 1 will take ...
3
votes
4answers
106 views

Use different colors for every another grep

How can I configure grep so that I could highlight in color smarter? By using different colors? Problem: grep --color defaults to using red to highlight matches, but it still difficult to read for ...
3
votes
2answers
744 views

Filter tail command through multiple grep commands to separate files

What I am trying to do is filter the output of one log file into separated log files based on a grep filter. tail -f test.log | tee >(grep "Error" > error.log) >(grep "Warning"" > warning.log) ...
0
votes
1answer
56 views

searching large number of possible file names in large directory tree

I need to search a large directory tree for a large number of possible file names, i.e. I have an input file with a long list of strings that I need to find in the tree (or as below: print all those ...
0
votes
1answer
28 views

How to use grep to match 2 patterns in different area's of a file and output result

I have a 3gb file to which I am trying to extract 2 patterns and output the result so that the information in pattern 1 Lines up with the information in pattern 2 Currently I have to run 2 grep ...
2
votes
2answers
808 views

grep --color=auto with -i option disables the matching text color, why?

I was messing around with grep and put this in my .zshenv: export GREP_OPTIONS="--color=auto" export GREP_COLORS='mt=1;34' I was bonking my head on the keyboard and changing GREP_COLORS around for ...
1
vote
1answer
35 views

How to have grep print only the matching text plus X surrounding characters

I need something similar to grep -A and grep -B but for characters. In other words, I have a file with incredibly long lines, e.g.: [thousands of characters] mytext [thousands of characters] If I ...
0
votes
0answers
11 views

“git grep” equivalent in Subversion?

I'm a big fan of git grep. Does an equivalent exist in Subversion?
3
votes
1answer
57 views

Using grep on URLs not working

I've got a couple of text files (a.txt and b.txt) containing a bunch of URLs, each on a separate line. Think of these files as blacklists. I want to sanitize my c.txt file, scrubbing it of any of the ...
0
votes
1answer
15 views

How can I exclude binaries from rgrep results in Emacs?

I'd like to add the I option to the grep that rgrep generates, but I cannot seem to find the appropriate variable. I've tried: grep-command grep-find-command
5
votes
1answer
361 views

How can I perform a second grep on the files returned from a previous grep?

I often find myself searching through a bunch of code using grep in order to pin down what I'm looking for. Sometimes I get a list of files a little longer than I hoped. At this point I want to ...
-2
votes
1answer
71 views

Grep word in one file, and use that word to match in another file, adding the thing that follows the match

I want to grep several words in file1, and use each word to grep what follows after its match in file2. And then I want to add the string that followed the match to the word I used into file03, so ...
0
votes
1answer
45 views

Run a block conditionally on grep output

I've found a number of solutions to this problem, but unfortunately none of them seem to work on my windows box. I'm running a FOR loop in a batch file to loop through a number of text files. For ...
0
votes
1answer
29 views

How to get the time information of the files after find | grep keyword command?

Now I know how to use find | grep keyword to get the file I want. But after that, how should I know the size, create_time info of each file I found? For example, after find | grep tutorial, I got ...
0
votes
1answer
65 views

watching output of “ps aux | grep blah” in tmux will not work?

I am trying to run this - watch "ps aux | grep myShittyProcess" in a tmux session. This process myShittyProcess was also started in a tmux session. The ps aux works without watch command. But as ...
0
votes
1answer
46 views

grep: Invalid back reference for date expression in tcsh

I googled for the following error, and didn't get any great explanations as to what was going on with grep under tcsh. (Yes, that date expression exists in the log files). $ grep '2014-07-21' *.log ...
6
votes
2answers
16k views

How to grep a log file within a specific time period

I have a log file, each line in the log is prepend with a date, like so: 2012-03-06 11:34:48,657 blah blah blah... How do I grep this file and get only the lines from 8am to 11pm only? My ...
1
vote
2answers
559 views

Exclude long lines from grep results

How do I exclude very long lines from grep results? I often grep through lots of .js files (-r) and some of them are compiled, so they consist of a single line usually a couple thousand characters ...
0
votes
0answers
31 views

Multiple grep command and show after line

I have this command grep -iE -A18 "$(date +"%Y-%m-%d").*error" * | grep -v -A18 'Movig to Error Queue' but the result shows me the 18 line after 'Moving to Error Queue' but I do not want that. I ...
0
votes
1answer
58 views

split a file by a line prefix

My data looks like this: 60 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 61 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 62 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 62 ...
1
vote
1answer
263 views

Windows XP - How do use grep to find strings in files in subdirectories

I once had a version of grep on my PC (I think it came with an early version of Delphi) which supported searching in nested folders with the -r switch. Now something (I suspect a later version of ...
0
votes
0answers
32 views

continued… grep -c gives inconsistent outputs [duplicate]

Possible Duplicate: grep -c gives inconsistent outputs I am trying to determine the number of processes that are running via the following command line: ps aux | grep -c 'Xvfb :1' When ...
0
votes
2answers
107 views

Print the common of the two files

I want to print the common of the 2 file One file contain the ls -l option and the other one have the ls option ls only has the file name ls -l has everything including the permission and other ...
2
votes
3answers
177 views

grep -c gives inconsistent outputs

I am trying to determine the number of processes that are running via the following command line: ps aux | grep -c 'Xvfb :1' When the process "fiji :1" is not running I sometimes get a value of 0 ...
2
votes
2answers
40 views

Find & replace on a folder of .txt (but only first 1-3 lines)

I have a folder of .txt files. They all look like this: Title: Title of blog post. Tags: tag1,tag2,tag3 Text on the post. Just my thoughts. > A blockqoute Written in *markdown.* Using ...
0
votes
2answers
3k views

Filtering output by OR condition in Linux

is there some way to filter output of command by OR condition in Linux? There is filtering by AND condition with grep in way like: ls -l | grep "^a" | grep "z$" That says: list all files that ...
2
votes
1answer
33 views

Colourized command for grep output

Hey forum! I have recently begun working with Debian and do so in a purely command-line environment. I connect from a windows desktop through puTTY using asymmetric encryption rather than passwords. ...
1
vote
2answers
861 views

How can I “grep” recursively filtering the name of the files I want with wildcards?

When I want to perform a recursive grep search in the current directory, I usually do: grep -ir "string" . But that command searches inside all kinds of files, including binary files (pictures, ...
1
vote
4answers
62 views

Check which string occurs first in a growing file

I'm running a remote executable which produces a logfile. I want to write a script to check whether the executable is run successfully or encounters an error. The way I can do this is by looking at ...
1
vote
3answers
56 views

Is there anything grep does better than ack? [closed]

I started using ack a while ago and it's amazing, but still begs the question: Is there anything grep still does better than ack? Or maybe is there something grep does that ack can't do?