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
13 views

Oneliner to get the list of filenames which have last line (or line on position X) matching certain pattern?

How to get the list of filenames which have last line (or line on position X) matching certain pattern? We are looking for oneliner.
-3
votes
0answers
46 views

How Can I Find All The Script Files on My PC? [on hold]

I would like to be able to search for all script files in order to bring what info is buried in various text files out so that relationships in the mind can form quickly as to: (a) How it is ...
0
votes
2answers
28 views

How to pass parameter in linux command at the end of the line

I would like to pass a parameter at the end of the line while I am giving a command in terminal. So I would like something like the example below find /path/to/directory -type f -exec grep -irl ...
1
vote
1answer
19 views

Using specific grep flags from BSD general commands version on a Mac

So I have been using a command piped through curl (on GNU/Linux's grep utility) to generate a random password string for tightening security on some of my accounts. curl -s ...
1
vote
1answer
33 views

Remove a certain part in a text file

I got the file, text.txt. In this file I have written: "test" "okay" I want to remove the " part of this file, how'd I do this?
0
votes
1answer
18 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
18 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
33 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 ...
1
vote
1answer
29 views

Windows gvim - use unix grep

Using Windows 10. I have gvim installed. I also have git, and I have git's bin in my PATH (C:\program files (x86)\Git\bin), which puts git's gnu grep in my path so I can use it in the command shell. ...
0
votes
1answer
28 views

Grep colorize complete line

I have a continuous output from a program which I grep for keywords. Now I want that the complete line is red colored, not just the keyword. How do I achieve that?
0
votes
1answer
10 views

is it possible to search case insensitive search using command line [windows 7]

I use grep -f d.txt OB.txt > r.txt to get the result file. But the search is case sensitive. Is there any case insensitive alternative to this?
0
votes
1answer
23 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

Use grep to NOT see files matching a pattern?

I'm very familiar with using grep with the pipe to exclude everything that doesn't match a pattern. But can I use grep to exclude everything that DOES match a pattern? I thought this would work, the ...
0
votes
1answer
16 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
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
2answers
15 views

Ubuntu replace expression in dir and all sub directories

How can I replace an expresion that has a forward slash with another in all dirs and subdirs? I used this to find: grep -rnw "/var/www/site" -e "app/COD1" And now I want to replace: "app/COD1" with ...
0
votes
1answer
35 views

What does xargs do exactly in this case?

I recently came across the following two examples Example 1: List only directories ls -l | grep "^d" Example 2: Search inside files ls | xargs grep -i "Find Some String" Now i have read from ...
-1
votes
2answers
22 views

why is the grep command being echoed [duplicate]

I currently have something like this. I am attempting to find a process with a certain name >:~# ps | grep avahi-daemon 12499 avahi 3048 S avahi-daemon: running [BlahBlah.local] 12500 avahi ...
3
votes
3answers
65 views

Filtering and splitting huge file based on column Windows

I have about 2 TB worth of data files formatted like 12/20/2015 somerandomdata 12/20/2015 somerandomdata 12/20/2015 somerandomdata 12/20/2015 somerandomdata 12/21/2015 somerandomdata 12/21/2015 ...
3
votes
1answer
26 views

Grep whole path

Hi I would like to do this ls * | grep pattern But I would like instead of just showing the file with the pattern the whole path of the files that match the patterns
-1
votes
2answers
58 views

Tail, cat and grep a file at the same time

So I need to monitor a log file in linux and I'd like to cat the contents (to see all previous entries) as well as tail the log file while simultaneously using the grep to filter out the stuff I want ...
-2
votes
1answer
22 views

How to find files within a size range?

Please suggest me the way to find all the zip files which are more than 60 MB but less than 70 MB in size using find command.
3
votes
2answers
18 views

How to get command output of “nvidia-settings” via command line?

the case at hand: nvidia-settings -q all | grep 'Attribute.*GPUCoreTemp' gives: Attribute 'GPUCoreTemp' (system5:0.0) 58. Attribute 'GPUCoreTemp' (system5:0[gpu:0]): ...
1
vote
1answer
19 views

Always coloring output of grep command

I almost exclusively use grep with -nr options and --color Can I set something in my linux environment to use it by default?
2
votes
4answers
557 views

Find | grep doesn't work in Cygwin

I have cygwin installed and when I search for the source code with this command nothing show up, even that I have that string in a file $ echo foo > bar $ find . -name '*' | grep foo Nothing ...
0
votes
1answer
25 views

grep command returning 0 - match all characters that are not digits globally

I am looking to search a file for all strings that do not contain digits, I've come up with the following regex. \D*/g Which works as I want in the this online tool: https://regex101.com/#pcre, but ...
1
vote
2answers
54 views

Keep grep output on one line?

I have a real quick question for you guys. After looking through the documentation and the site here, I was wondering if it were possible to keep grep from outputting each match on the same line. In ...
1
vote
2answers
49 views

Select all instances of quoted text from a file

Is there any way to grep or obtain in any other way all instances of text within each pair of double quotes in a file? I've seen answers like this: ...
1
vote
0answers
52 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 ...
-2
votes
1answer
34 views

Filter curl header output in verbose mode

Using curl -v ..., i.e. the verbose mode that prints out the input and output headers. However, this info is not piped and I can not grep-out lines which I dont need. How can you filter curl header ...
2
votes
2answers
31 views

Grep: Count specific string in all recursive files with matchi filename

I already could manage to count strings in all files in directory: grep -roh „XXX" . | wc –w But I don't know how to isolate the statement. I only want to count the words in files which have the ...
1
vote
1answer
43 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 ...
0
votes
0answers
12 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
36 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
22 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 ...
1
vote
2answers
41 views

grep: return NULL if false

I'm trying use grep to extract attributes from a large collection of XML files. I've tried usinggrep -E -m 1 -o -Z "<tag>(.*)</tag>" /home/somepath/*.xml || printf "NULL" but for some ...
-1
votes
1answer
16 views

How would you count every occurrence of a term in all files in the current directory?

How would you count every occurrence of a term in all files in the current directory? - and subdirectories(?) I've read that to do this you would use grep; what is the exact command? Also, is it ...
0
votes
2answers
44 views

remove pattern with random numbers (digits) from php files

I am trying to remove or replace the digits ((random numbers)) in big numbers of php files using find & xargs and grep with sed etc .. the numbers looks like that inside the php file ...
1
vote
1answer
40 views

How to find the last 2 characters of Chinese names with command lines tools?

I have a list of Chinese names, some of them have 2 characters, others may have more or less, like following: I want to use some command lines tools, to find the last 2 characters of each. If ...
1
vote
1answer
17 views

remove wayback toolbar code in bewteen lines

I am trying to remove Wayback toolbar code using some tools such as find & xargs and grep with sed etc issue that the size of the html & php files it's over 7GB & as well as the pages ...
0
votes
1answer
25 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 ...
0
votes
1answer
70 views

how to move files that contain string using find, xargs, grep, in linux

i have many php files maybe over Three million.. how can i use grep with xargs and find with mv to find contain the string in files and move them to directory if they match. I try like that find . ...
0
votes
1answer
17 views

Converting from vim search to sed

I have a long Latex document with many sections. I'd like to check that all sections of the document are filled in. So I search for any time there is a '}' ending a section title, somewhitespace, and ...
0
votes
2answers
52 views

How do I search for a pattern using GREP that must occur AFTER the nth occurrence of another pattern on the same line?

I have a file with records that are pipe ('|') delimited. I need to search for a specific string on the 6th column only and then return the entire line through the grep utility. There are totally 10 ...
1
vote
0answers
33 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 ...
0
votes
3answers
63 views

grep on Windows 7 Invalid Argument

I am using grep from Gnuwin32 on Windows. Doing: grep -r INSERT *.sql Yields: grep: *.sql: Invalid argument Any idea why?
0
votes
2answers
49 views

How to grep a whole word containg a dot (.)

My file contains the following text xyz.com 123 321 xyz.com.br 123 123 abcd.xyz.com 123 321 I want to grep the line which contains xyz.com alone. ie, the output should be the first ...
0
votes
1answer
55 views

Gnuwin32 grep: piping output on cmd.exe or Powershell

I' m trying to use the Gnuwin32 grep command to produce a list of files I would like to feed to another command (a Perl script really). I have a bunch of HTML files and I wish to list every one of ...
0
votes
1answer
39 views

Why does grep -r --include=*.js * > dirname/.filename not write all .js files to a single file?

I am trying to put all js files in a directory and sub directorys into a single file in lexical order. What did I do wrong?
2
votes
2answers
68 views

Performing PowerShell analog of *nix grep <multiple files by mask>

Is there a way to optimize PowerShell code below (it greps particular lines by string contained from a bunch of text files into a single one): $ErrorActionPreference = "Continue" Start-Transcript ...