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
297 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
112 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
85 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
204 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
534 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
80 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
157 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
122 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
22 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
11 views

Which of the following use of anchor is correct in regex using grep?

Both of the below commands gives the same output, however which one is the correct method to use it? grep ^'\<that\>' file.txt Searches for the line which has that as the first word grep ...
0
votes
1answer
44 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
28 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
19 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
40 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 ...
0
votes
1answer
28 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
22 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
27 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 ...
2
votes
0answers
109 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 ...
2
votes
0answers
51 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 ...
1
vote
0answers
70 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 ...
1
vote
0answers
45 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
40 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
48 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
46 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
55 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
15 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
8 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
10 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
52 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
28 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
20 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
18 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 ...
0
votes
0answers
52 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
30 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
32 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
16 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
164 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
13 views

Mac OS X Find and Replace API

Are the Find and Replace operations under the Edit menu in Acrobat or Word simply a front end for the unix awk, sed or grep commands? Where can I find more information about what's going on underneath ...
0
votes
0answers
78 views

grep - Grepping several lines from Nmap output

My scan root@kali:~# nmap -Pn 5.2.167.13 Starting Nmap 6.47 ( http://nmap.org ) at 2015-07-07 14:33 EDT Nmap scan report for static-5-2-167-13.rdsnet.ro (5.2.167.13) Host is up (0.010s latency). Not ...
0
votes
0answers
109 views

Write error Broken pip - Kali - Python

I have a problem im trying to perform grepping over nmap scan saved text file using python code but i get this error: cut: the delimiter must be a singel character Try 'cut --help' for more ...
0
votes
0answers
192 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
52 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
129 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
208 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. ...
-1
votes
0answers
20 views

Tail a log file with today`s date

So i am trying to come up with a command to tail a log file with todays date. The log file gets updated everyday with the current date. As the number of lines for the log for any particular day can ...
-1
votes
0answers
13 views

Search content of odf (odt|ots|odp) documents from command line

I want to search the content of some odf document (Libre Office document) from command line. I want something like: odfgrep <search-pattern> <file-name> I found something of interest ...