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
2 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... ...
1
vote
1answer
20 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, ...
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
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
1answer
23 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 ...
0
votes
0answers
28 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
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 ...
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 ...
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 ...
-1
votes
1answer
44 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 ...
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 ...
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
46 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. ...
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 ...
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 ...
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?
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
360 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 ...
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
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 ...
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
57 views

split a file by a line prefix

My data looks like this: 60 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 61 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 62 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 62 ...
1
vote
1answer
260 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 ...
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 ...
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
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?
0
votes
1answer
20 views

Extracting part of a large SQL dump

Is there a way to chain commands like grep and head together to extract a portion of a file? The problem is that somewhere in my .sql file I have an old data that I need to compare to new data and I ...
1
vote
2answers
84 views

grep to display all IPs in a text file (linux)

I'm writing a script to look for a ping from a certian foreign IP, but I am having some trouble understanding how to format my "grep" command.. Inside my text file is the output from "netstat anp" ...
0
votes
2answers
43 views

How to retrieve a name from another file with a Bash script?

I would like to grab a name out of another predefined file and use it within my shell script. The file being read would be in ./docs/description.org and the format (a table in .org format) is: ...
0
votes
0answers
69 views

cron job monitoring script

greeting of the day!!! please help me a situation, i am trying to develop a script which provides me details which my cron job is commented or stopped which job is running or scheduled. like we ...
1
vote
1answer
64 views

How do I grep a string from files created within the last 5 hours?

I have a directory that is populated every 30 mins with a text file, each day I need to grep the line with "Quality data" on it but I only want to grep from the 10 most recent files. How can I tell ...
0
votes
1answer
44 views

String pattern searching

I'm new to linux. I want to be placed as a System Admin. I attended an interview at Amazon. They asked me to write a cmd to find the string that starts with 's' and ends with 'a' in a file. I know ...
0
votes
1answer
29 views

Using Grep or AWK to find all of the occurences of a specified string

I have a massive single line of data and I am trying to find the occurrences of a specified string. I then want to export the occurrences (-/+) 20 characters to another file. Can anyone offer a ...
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
1answer
29 views

Pipeing lines to repeat commands

If my grep operation returns a list of ID's like: 12345 84758 49549 .. can I somehow feed/pipe each line to a commandline command's parameter? Like for example with the above result from grep, I'd ...
-2
votes
3answers
138 views

osx bash grep - finding search terms in a large file with one single line

Is there simple unix command line i can enter which lets me isolate say 512 bytes either side of a search term, even if there is only one "line" in a very large text file? Ok, this should be easy. ...
3
votes
2answers
1k views

How to search a text file for strings between two tokens in Ubuntu terminal and save the output?

How can I search a text file for this pattern in Ubuntu terminal and save the output as a text file? I'm looking for everything between the string "abc" and the string "cde" in a long list of data. ...
0
votes
2answers
37 views

Use grep to find files and pipe/open to open them

How can I pipe files from grep to open all matching files? I've tried grep -li "type" * | open, but that does not work.
0
votes
1answer
50 views

Perform a GROUP BY-like command in UNIX

I am having a text file like the following: 1 2 3 4 5 6 7 8 9 ... n <-- column numbering 1 0 0 1 0 0 0 1 0 ... 0 0 1 0 0 0 0 0 0 0 ... 1 1 0 0 0 0 0 0 1 1 ... 0 0 1 1 1 0 1 0 0 0 ... 0 0 1 0 0 ...
0
votes
1answer
68 views

How to grep values under columns

How can I grep for a specific column name and display the value underneath that column. Sample data: StandByFile StandByPg StandByLSN StandByRcvBufUsed S0082160.LOG 621668 ...
0
votes
2answers
48 views

How to List Files greater than particular timestamp?

I have a directory in linux which has a list of log files where log files get auto generated if some job runs. Each log file gets appended with the timestamp like "JobName_TimeStamp" UPDATED: ...
0
votes
1answer
50 views

awk used with grep - no output

I have a bashscript which uses grep with awk as following: #ec2-describe-instances | grep -i instance | awk '{print "Creating -> " $3; system("ec2-create-image " $2 " --name " $3 "-$(date +%F) ...
1
vote
2answers
852 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
2answers
147 views

Compare MAC address of live network interface using grep to existing configuration files

Cloning VMs creates new network interface everytime on CentOS/RedHat VMs. I need to rename the ifcfg-eth* to the same name as the live interface on the VM. What I would like to do is to use a script ...
1
vote
2answers
39 views

How do I print multiple sections in a text file?

I have a text file looking something like this: *FILESTART line_a line_b line_c *INCLUDE file_A.key file_B.key *INCLUDE file_1.key file_2.key file_3.key *SOMETHING_ELSE line_x line_y line_z *END I ...