I wanted to grep for java process and then find the max heap memory used.
I tried this
def ex =['sh','-c','ps -aef | grep Xmx'];
String str = ex.execute().text;
while str has something like " java -Xmx1024M /kv/classes/bebo/ -Xms512M"
How do I extract the value 1024M. I was planning to user java regex but thought someone might know a ...
I have a directory full of files and I need to pull the headers and footers off of them. They are all variable length so using head or tail isn't going to work. Each file does have a line I can search for, but I don't want to include the line in the results.
It's usually
*** Start (more text here)
And ends with
*** Finish (more te...
Hi
I'm looking for a good tutorial on using regular expressions especially with grep. I tried googling for some but most tutorials are too basic and cover things I already know.
...
I'm looking for a method to grep for multiple atoms e.g. "foo" and "bar".
I'm aware i can use
grep 'foo' file | grep 'bar'
to get both of them but i was wondering if there was a more efficient way. Any googleing seems to only throw results for an 'or' based search rather than 'and'.
...
I'm trying to build GNU grep, and when I run make, I get:
[snip]
/bin/bash: line 9: makeinfo: command not found
What is makeinfo, and how do I get it?
(This is Ubuntu, if it makes a difference)
...
How can I include a blank space ' ' and a comma ',' in this simple regular expression?
\w{1,64}
\w corresponds to: [A-Za-z0-9_], viz avery char between a-z (case sensitive/insensitive), numbers between 0-9 and the underscore.
I need to add space and comma to this. I've been trying directly whit
[A-Za-z0-9_, ]
but this did allow cha...
I'm looking for a SimpleGrepSedPerlOrPythonOneLiner that outputs all quotations in a text.
Example 1:
echo “HAL,” noted Frank, “said that everything was going extremely well.” | SimpleGrepSedPerlOrPythonOneLiner
stdout:
"HAL,"
"said that everything was going extremely well.”
Example 2:
cat MicrosoftWindowsXPEula.txt | SimpleG...
I need to grep for lines with bunch of names, say "[email protected]", "[email protected]" from a file.txt
file.txt has junk which is [email protected] [email protected]. I need to filter these out
Once I get these lines I need to grep for gmail and yahoo and get their counts
List l = new ArrayList{[email protected], [email protected]}...
I refactor my code and I am looking for a solution to grep my source files for something like
if ( user && user.name && user.name.length() < 128 ) ...
in order to replace it later with ruby's andand or groovy's ?. operator (safe navigation operator).
...
I'm trying to use grep with -v for invert-match along with -e for regular expression. I'm having trouble getting the syntax right.
I'm trying something like
tail -f logFile | grep -ve "string one|string two"
If I do it this way it doesn't filter
If I change it to
tail -f logFile | grep -ev "string one|string two"
I get
grep: s...
I want to search for a line in a file, using regex, inside a Perl script.
Assuming it is in a system with grep installed, is it better to:
call the external grep through an open() command
open() the file directly and use a while loop and an if ($line =~ m/regex/)?
...
I need to know how I can search an array for some literal text and have it used as a condition whether to continue.
Heres why:
Each time I execute a function I am pushing the ID of the property it acts upon into an array. I need my funtion to check if that ID is in the array already and if it is, remove it and execute my other function ...
I have a bunch of log files. I need to find out how many times a string occurs in all files.
grep -c string *
retruns
...
file1:1
file2:0
file3:0
...
Using pipe I was able to get only files that have one or more occurrence:
grep -c string * | grep -v :0
...
file4:5
file5:1
file6:2
...
How to get only the combined count? (If it ...
How do I use grep to perform a search which, when a match is found, will print the file name as well as the first n characters in that file? Note that n is a parameter that can be specified and it is irrelevant whether the first n characters actually contains the matching string.
...
I want to do this:
findstr /s /c:some-symbol *
or the grep equivalent
grep -R some-symbol *
but I need the utility to autodetect files encoded in UTF-16 (and friends) and search them appropriately. My files even have the byte-ordering mark FFEE in them so I'm not even looking for heroic autodetection.
Any suggestions?
Thanks,...
I have three arrays.
@array1 containing filenames
@array2 containing filenames
@unique which I want to contain the unique items
I use the following code to compare the two arrays and output a third array that contains the unique filenames.
@test{@array1} = ();
@unqiue = grep {!exists $test{$_}} @array2;
However the output is case...
Recently there have been a few attackers trying malicious things on my server so I've decided to somewhat "track" them even though I know they won't get very far.
Now, I have an entire directory containing the server logs and I need a way to search through every file in the directory, and return a filename if a string is found. So I tho...
I want to pipe the output of grep as the search patter for another grep.
As an example:
grep <Search_term> <file1> | xargs grep <file2>
I want the output of the first grep as the search term for the second grep. The above command is treating the output of the first grep as the file name for the second grep. I tried using -e option fo...
Looking for a nifty helper function/method for grepping through all defined tables, columns, stored procedures, etc, for a MySql database.
I had something similar for SQL Server.
...
When 'make'-ing under vim, there is often a need to vimgrep the files.
In such cases, vimgrep takes over the quickfix buffer, so one needs to re-make in order to browse remaining compiler errors.
Is there a way to avoid this mess?
...