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

3
votes
1answer
331 views

ag (the_silver_searcher) not searching entire file - does it have an implicit maximum input size?

I have a very large plain text file (multiple gigabytes in size) which I need to search for certain strings. When using grep, I get over 11,000 matches of a string but with ag I get roughly 1,500. The ...
1
vote
1answer
162 views

R: subset lines of a dataframe containing a string in another file

I would like to subset the lines of data frame 1 (df1) that contain a string from a column in data frame 2 (df2). The problem is that file1 will have multiple strings in the same column. I have tried ...
1
vote
1answer
87 views

Searching across multiple documents for common words

I have the lyrics to a song. (.txt) I also have lyrics to 50 other songs. I'm looking for a way to analyse/search those 50 song lyrics with the lyrics to the first song, and find which one of the ...
1
vote
1answer
242 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
1answer
620 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 ...
1
vote
1answer
84 views

Piping lines to repeat commands

If my grep operation returns a list of IDs like in the following, can I somehow feed/pipe each line to a commandline command's parameter?: 12345 84758 49549 .. Like for example with the above ...
1
vote
1answer
164 views

How does grep deal with overlapping lines?

Suppose my text file looks like this: hello world1 foo bar2 hello world3 foo bar4 hello world5 foo bar If I run this command grep -A 4 'hello' draft.txt, I thought it print something like this: ...
1
vote
1answer
132 views

Find word that has more than 50 characters in all php files

I am trying to use find in combination with grep to find all the php files in my web server which have a word (any sequence of characters except whitespace) with more than 50 characters. I have this ...
1
vote
1answer
2k views

Using tee to pipe ls and grep output into tail command without a script

I have an issue running through log files. I'm looking to use ls to create a list of files in the log directory and grep to run through for the specific instances/times the file ran. I only want to ...
0
votes
1answer
20 views

need help grep playlist

I use a playlist from the Internet that gets updated every day. I want to sort and grep URLs. The playlist is a mess and looks like this #EXTINF:-1 tvg-id="ORF1.at" group-title="Deutsch" tvg-logo=...
0
votes
1answer
13 views

how to filter text file on the basis another text file.

I have two text files . One is wordlist and another one is file to be filtered. I want to remove or delete all the lines or links from the file if the line has any word from word list anywhere in ...
0
votes
1answer
31 views

Bash script to find content of file in a directory and add value

I have a directory with a huge number of files. I want to write a bash script to - Enter that directory Find out which of them are Perl scripts (but none of them have a .pl extension) Add a line at ...
0
votes
1answer
54 views

searching the string with the time in log file using shell script by passing variables

I want to search a string and subtract the time that is found from the current time. When used, the script should show the lines from that time or from the very next log time frame. I'm able to ...
0
votes
1answer
56 views

How to grep a log file within a specific time period with string

I have a log file in this format: 2016-01-21 01:56:48,586 [http-nio-8320-exec-54] INFO config.web.login - Successful login. Username: XYZ, xxxxx How do I grep this file and get only the lines ...
0
votes
1answer
22 views

How to extract only a part of a string

I have a batch file using wget and grep that downloads a website, and then extracts the fallowing string from the source code. <p>11.59 €</p> As you can see, grep included the paragraph ...
0
votes
1answer
44 views

redirect ALL output from shell to a command to act as filter

How to redirect all std-output from bash to a command like 'grep' or 'sed' to filter the output and then write it to a file? This is what I want in principle: exec > >(cat | cat >>/tmp/...
0
votes
1answer
35 views

Pipe arguments into “open” command

I'm trying to open a large list of .xml files using the following command: ls | grep navigation-drawer-config- | open However, this doesn't work. From my understanding of piping, this should pipe ...
0
votes
1answer
23 views

How to grep in tail in several files

I need to tail several files, and most info from them i removing (using grep). Now mine output dirty with file names. How i can remove them? Short to problem: $ tail -F /log/rest_server*.log | egrep -...
0
votes
1answer
29 views

Save text from file between two given characters and save the output to file?

I have a file with the following kind of text: @ heading with some text the.actual.text.of.choice which.can.be.several.lines in.length.with.no.pattern + more.text.that.i.want.to remove.several.lines....
0
votes
1answer
131 views

How do I search for a string of text in all the files sitting inside folder and its subfolders?

I wish to use a grep search to find the string 'base64' in any/all php files in a folder (and its subfolders) saved on my mac's desktop. I'm not very experienced using the Terminal command line ...
0
votes
1answer
30 views

Awk eqivalent to grep -C <num>

I want to print 5 lines of context around each line that matches "foo" but not "foobar". I can do the match easily enough via <output> | awk '/foo/ && !/foobar/' but I can't figure out ...
3
votes
0answers
66 views

Breadth-first search with ack or grep

When I search e.g. my home directory with ack (or grep), I normally want to know where I set a specific option. Since most config files are really close to ~ it would considerably speed up ack if I ...
2
votes
0answers
146 views

How to print absolute paths with git grep

I use the following grepcode command to recursively search a large number of git repositories. It prints the path of found files relative to the repository root, how can I print the absolute path of ...
1
vote
0answers
85 views

How to ls -l file from output of grep

I was trying to run the following command: ls -lh `grep -E "^log4j.appender.File" /var/domains/*/servers/*/logs/log4j.properties | sed 's/.*=//g'` but it shows me error: ls: cannot access /var/app/...
1
vote
0answers
66 views

Change InDesign paragraph style based on previous paragraph’s style (with GREP?)

I am re-typesetting a book to be published in its second edition. I have inherited the InDesign files from the designer who set the original book, and there are certain things that lead me to believe ...
1
vote
0answers
41 views

Grep exit status not returning expected value

In file "WAP" word is there. When I am running grep command grep -i "WAP" filename. I am getting exit status 0. That is fine. But when I am searching for those words which they are not in file. I am ...
1
vote
0answers
55 views

Search text in zipped files and move them to other folder

Friends, On my Mac, I have 100s of zip files in a directory named Test. Let's assume I have files a.zip,b.zip,c.zip....... Now I want to grep all files for a text "searchText" and move the matching ...
1
vote
0answers
49 views

Non-deterministic behavior of Grep in conjunction with More

What would you expect to happen after this: for /l %i in (1,1,100) do @more some.bbl | grep a | md5sum Most probably, not this: ec3ecb76408d4225ff23a25d0596e00f *- 13cfd899b90b9cd7aedb406a785e8eac ...
1
vote
0answers
58 views

grep php output show more than grep query

I'm having an issue where php file | grep "query"'s output shows EVERYTHING, not just the grep'd output. EX: php /vagrant/code/test.php | grep "Do not show anything" Shows anything echo'd in the ...
1
vote
0answers
33 views

ack.pl tool and ack.pl flags + how to ignore files with S attr

I am using the ack.pl tool in order to search string or IP’s in files The official site of ack.pl is - http://beyondgrep.com/documentation/ Example of ack.pl CLI ( want to find the string ...
0
votes
0answers
8 views

limits for grep -A / grep -B

I have log-file which contains only 1 appearance of word 'begin' and 1 'end', and 'begin' is before 'end'. Now I want to cut this part between begin and end (including these lines): grep -A 999999 "...
0
votes
0answers
19 views

Matching 3 or more words from fields in seperate csv files.

I have two csv files: This is csv1: 11, The Sun Still Shines in Reading, 64312, 464566 13, You and Me Together Again London, 564564, 131355 12, What's the Story Now Your Gone, 4545646, 1124545 17, ...
0
votes
0answers
22 views

About grep, what's the main difference between using option E(ERE) and P(Perl)

About Grep tool in RHEL, usually I use -E option which is ERE grammar, but sometimes I use -P to use the look-ahead/behind-positive/negative grammar. I know -P is more powerful than -E, but not ...
0
votes
0answers
10 views

Silver Searcher scrambles terminal when it hits binary files

When using silver searcher (ag), my terminal gets scrambled, presumably upon hitting special characters in some binaries. Of course I can just blindly type reset to get things back to normal, but ...
0
votes
0answers
16 views

Convert list of Hardened Linux From Scratch packages into suitable format for md5sum -c

I'd like to create a file suitable for using with md5sum -c from this document: http://www.linuxfromscratch.org/hlfs/view/development/chapter03/packages.html I imagine this should be possible by ...
0
votes
0answers
94 views

A grep for Windows that works

I need to search a very large file (a Registry export file) for a specific string. Registry Editor has no way of simply viewing a Registry file and this file is too large to open in a text editor ...
0
votes
0answers
34 views

Finding a text string on a website and all its links

Can you help me understand process of finding a certain text string on a website and all its immediate links? I started delving into wget and curl with help of grep but was unable to come up with ...
0
votes
0answers
34 views

zgrep not working at all on Mac OSX

I'm trying to search through log files which have been zipped up using zgrep. I can't seem to get zgrep to work on my Mac whereas zgrepping on CentOS works just fine. To ensure that I was not ...
0
votes
0answers
45 views

Searching for a string with grep

I'm looking for a way to retrieve a dollar amount from a website using a combination of wget and grep. This is what I've got so far: wget http://csgobackpack.net/?nick=jotnova -q -O - | grep -o "[...
0
votes
0answers
35 views

storing matched string in a variable in c shell

I am writing a csh script and I am new to C shell. I am using grep but I want to store the matched string in a variable and append it everytime there is a match. The code is somewhat like set $var=`...
0
votes
0answers
62 views

Ping multiple domains from file and out only desired IP

Need bash script to ping multiple domains from file and output just domains with adress ip : 1.2.3.4 exemple (domains.txt): www.google.com support.mozilla.com stackexchange.com support.mozilla.com ...
0
votes
0answers
41 views

Making a simple web app to boolean search a text file?

I have a text file which contains around 10K lines of text. Pretty much basic sentences. I want to find a very simple way to have a web app that can to perform a simple boolean search (just the ...
0
votes
0answers
35 views

grep : how to do it as fast as possible

I have 30GB log files in .gz format. I'm using zgrep to search and calculate total number of user connection. What I do is to zgrep and take domain name from the first big .gz file, and search for ...
0
votes
0answers
18 views

How to diagnose command-line hang if looking at it with Process Explorer makes the hang stop?

It's a command-line hang, so you'd think it would be easy to diagnose. But I just can't figure out why 1 out of 25 times, certain scripts of mine hang. I'm sure it's something I've done. Typically, ...
0
votes
0answers
213 views

ag (silver searcher): ignoring specific text extensions

I want to use ag to search inside all text files in a directory for a given string, but excluding some extensions such as *.html. If I use both the -t/--all-text and --ignore "*.html" flags, the ...
0
votes
0answers
208 views

how to grep exact pattern

I’ve tried several grep / egrep ideas with different options but none worked here. I’m trying to grep exact match of the pattern I’m looking in a log. For example I want only a pattern “ERROR” to get ...
0
votes
0answers
56 views

grep not matching patterns in scripted session

Asked this question on the Unix board and got slapped for it. Someone said this was the right place so hopefully that's right. We have a bunch of reports that run on a Linux server and I am trying to ...
0
votes
0answers
134 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. ...
0
votes
0answers
224 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 ...
0
votes
0answers
45 views

Finding files that are mostly NUL

I've got a hard drive copy that went bad where many files are of correct size but are completely filled with NUL (0x00) bytes. However, a couple of the files seem to have a couple KB of actual data. ...