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

-1
votes
2answers
24 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
126 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
33 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
110 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
27 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
35 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
20 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
888 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
27 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
225 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
50 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
75 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
119 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
36 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
129 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
21 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
53 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
36 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
45 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
20 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
63 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
48 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
25 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
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 ...
0
votes
1answer
138 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
21 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
77 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
53 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
108 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
82 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
65 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
42 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
89 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 ...
0
votes
1answer
104 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 ...
2
votes
0answers
119 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 ...
0
votes
1answer
218 views

Extracting lines from a large text file which follows a pattern

How do i extract lines from a text file which satisfy this regex ^2. I am using linux. I know grep is able to extract the number of lines but i would need them to be output to a text file. Is it ...
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 ...
1
vote
1answer
89 views

Grep matching lines but return matching key IDs in GnuPG output

Having this input: rsa2048/C7927B82 2015-08-30 rsa2048/FB2D99F9 2015-08-30 I want grep to only return the key ID, for example: C7927B92. Using the pattern from Grep characters before and after ...
-1
votes
2answers
46 views

grep - mark this line, which contains even quantity selection

I would like to mark this line, in which there are even quantity selection. In this case I want to mark even number of digits too. for example: for input: 22 34 423 22 23213 34 345 23 Result should ...
1
vote
1answer
44 views

grep - mark the same digits in the line bash

I want to mark the same digits, which can repeat 3 times. My command: grep -E '[[:digit:]]{2,3}' file mark every digits, but I want to one the same digit. Input: 11111 222 33 ...
0
votes
2answers
41 views

Linux : let process run per CPU

My server has 4 CPUs, and I'm parsing a file using grep. It's very slow using just one process. Is it possible to let run four processes using these 4 CPUs? How to do it ? Thanks.
1
vote
1answer
54 views

Can using a SSD speed up “grep”?

I need to use grep to parse a 50GB file, and it's very very slow on my server. I wonder if it'll be faster if I replace my server disk with SSD? Is it worth the upgrade? Thanks. Edited: This is ...
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
1answer
99 views

how to grep something with a wildcard path?

I want to grep a Gemfile in few rails apps. But for each rails app there are many branches and out of which the latest branch name lets say is 'main'. The structure is something like this: workspace ...
0
votes
0answers
17 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, ...
3
votes
1answer
28 views

How can I mark two columns in the middle of text

How can I mark two columns in the middle of text. grep --color '^[[:alnum:]]*[[:blank:]]' file This mark text in the beginning, but I want to mark second and third columns. How can pass first one?
-1
votes
1answer
36 views

bash change strings with multiple escape characters

Hello i try to automate for example change one variable in php file . root /tmp # cat defaults.inc.php|egrep "reply_all_mode" $config['reply_all_mode'] = 0; I try to first catch this by grep ...
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
51 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 ...
0
votes
2answers
106 views

How to insert lines into specific files in which a string is not present?

I'm looking for some help with a small script. I would like to search all files corresponding to /usr/local/directadmin/data/users/*/httpd.conf for the string centralized.log If the string is ...